ABS                             0001                              Syntax:                                                                              ABS                             0002                                                                                                                   ABS                             0003                                ABS(numeric-argument)                                                              ABS                             0004                                                                                                                   ABS                             0005                              Discussion:                                                                          ABS                             0006                                                                                                                   ABS                             0007                                The ABS function returns the absolute value of a numeric                           ABS                             0008                                argument. "Absolute value" is the magnitude of a numeric value,                    ABS                             0009                                regardless of the sign of the value. Thus, the result of the ABS                   ABS                             0010                                function will always be a positive number or zero.                                 ABS                             0011                                                                                                                   ABS                             0012                                The numeric-argument may be a numeric constant, a single-element                   ABS                             0013                                numeric variable, a numeric array element, a numeric expression,                   ABS                             0014                                or a numeric function.                                                             ABS                             0015                                                                                                                   ABS                             0016                                The intermediate result of the ABS function is stored in an                        ABS                             0017                                accumulator with the same precision as the numeric-argument. If                    ABS                             0018                                this intermediate result is moved to a receiving numeric                           ABS                             0019                                variable, its precision is automatically adjusted to the defined                   ABS                             0020                                precision of that variable.                                                        ABS                             0021                                                                                                                   ABS                             0022                              Example 1:                                                                           ABS                             0023                                                                                                                   ABS                             0024                                A = ABS(B)                                                                         ABS                             0025                                                                                                                   ABS                             0026                                In the above example, the absolute value of numeric variable B is                  ABS                             0027                                stored in numeric variable A.                                                      ABS                             0028                                                                                                                   ABS                             0029                                For example, if B equals -27, then A equals 27 (the absolute                       ABS                             0030                                value of -27).                                                                     ABS                             0031                                                                                                                   ABS                             0032                              Example 2:                                                                           ABS                             0033                                                                                                                   ABS                             0034                                ON ABS(X) GOTO 100,200,300,400,500                                                 ABS                             0035                                                                                                                   ABS                             0036                                In this example, the integer portion of the numeric variable X is                  ABS                             0037                                used as the control variable for the <ON/GOTO> statement.                          ABS                             0038                                                                                                                   ABS                             0039                                For example, if X equals -1, the absolute value equals 1, and the                  ABS                             0040                                ON/GOTO statement will transfer the program to statement label                     ABS                             0041                                300.                                                                               ACCESS                          0001                              Syntax:                                                                              ACCESS                          0002                                                                                                                   ACCESS                          0003                                ACCESS (directory-access-block) [directory-name]                                   ACCESS                          0004                                       [,EXCP=statement-label]                                                     ACCESS                          0005                                                                                                                   ACCESS                          0006                              Discussion:                                                                          ACCESS                          0007                                                                                                                   ACCESS                          0008                                The ACCESS statement accesses Comet directories. The ACCESS                        ACCESS                          0009                                statement may be used in any MTB program.                                          ACCESS                          0010                                                                                                                   ACCESS                          0011                                The directory-access-block (DAB) parameter is an integer from 0                    ACCESS                          0012                                to 49. This may be a numeric constant, numeric variable, or a                      ACCESS                          0013                                symbolic constant.                                                                 ACCESS                          0014                                                                                                                   ACCESS                          0015                                The directory-name parameter specifies the directory to be                         ACCESS                          0016                                accessed. If this parameter is omitted, the statement releases                     ACCESS                          0017                                the directory access block (i.e., it "un-accesses" a directory).                   ACCESS                          0018                                This parameter can be a string constant or string variable with a                  ACCESS                          0019                                length of three characters.                                                        ACCESS                          0020                                                                                                                   ACCESS                          0021                                The statement-label parameter specifies the branch label to which                  ACCESS                          0022                                program control is transferred if an exception occurs.                             ACCESS                          0023                                                                                                                   ACCESS                          0024                                Application note: The ACCESS statement is part of the system                       ACCESS                          0025                                security scheme in Comet. Under a security version of the                          ACCESS                          0026                                QMONITOR program, the ACCESS statement grants access to only the                   ACCESS                          0027                                Comet directories listed under the user's password. In general,                    ACCESS                          0028                                however, the ACCESS statement may be built into any MTB                            ACCESS                          0029                                application program to provide directory-level security.                           ACCESS                          0030                                                                                                                   ACCESS                          0031                              Example:                                                                             ACCESS                          0032                                                                                                                   ACCESS                          0033                                ACCESS (5) "SSI",EXCP=9000                                                         ACCESS                          0034                                                                                                                   ACCESS                          0035                                In this example, the Comet directory named "SSI" is accessed as                    ACCESS                          0036                                DAB 5. If an exception occurs when this statement is executed,                     ACCESS                          0037                                program control will be transferred to statement 9000.                             ACTIVATE                        0001                              Syntax:                                                                              ACTIVATE                        0002                                                                                                                   ACTIVATE                        0003                                ACTIVATE partition, program [,DIR=directory]                                       ACTIVATE                        0004                                         [,EXCP=statement-label]                                                   ACTIVATE                        0005                                                                                                                   ACTIVATE                        0006                              Discussion:                                                                          ACTIVATE                        0007                                                                                                                   ACTIVATE                        0008                                The ACTIVATE statement executes a specified program in a named                     ACTIVATE                        0009                                partition.                                                                         ACTIVATE                        0010                                                                                                                   ACTIVATE                        0011                                The partition parameter is the name of the partition from which                    ACTIVATE                        0012                                the program you specified will be executed. This can be a string                   ACTIVATE                        0013                                constant or a string variable, with a length of three characters.                  ACTIVATE                        0014                                If this string is null, Comet will attempt to activate the                         ACTIVATE                        0015                                specified program in the first available background partition                      ACTIVATE                        0016                                (and the name of this partition is returned in the system                          ACTIVATE                        0017                                variable named <SYSPART$,#HELPMT3>).                                               ACTIVATE                        0018                                                                                                                   ACTIVATE                        0019                                The program parameter is the name of the program to be executed                    ACTIVATE                        0020                                in the partition you specified. Program names can have a length                    ACTIVATE                        0021                                of up to eight characters, and can be a string constant or a                       ACTIVATE                        0022                                string variable.                                                                   ACTIVATE                        0023                                                                                                                   ACTIVATE                        0024                                The directory parameter (optional) is the Comet directory where                    ACTIVATE                        0025                                the specified program is located. It can be string constant or                     ACTIVATE                        0026                                string variable, with a length of up to three characters. If a                     ACTIVATE                        0027                                directory name is specified, only that directory is searched for                   ACTIVATE                        0028                                the program. If a directory name is not specified, the system                      ACTIVATE                        0029                                searches all accessed directories in accessed order until the                      ACTIVATE                        0030                                program is found.                                                                  ACTIVATE                        0031                                                                                                                   ACTIVATE                        0032                                The ACTIVATE statement can pass up to 16K of <COMMON,#HELPMT3> to                  ACTIVATE                        0033                                the program being activated.                                                       ACTIVATE                        0034                                                                                                                   ACTIVATE                        0035                                Application notes:                                                                 ACTIVATE                        0036                                                                                                                   ACTIVATE                        0037                                1. When activating a background partition, pay special attention                   ACTIVATE                        0038                                   to logical unit number 0. In a background partition, there is                   ACTIVATE                        0039                                   no video device, and logical unit number 0 may be used for                      ACTIVATE                        0040                                   other purposes.                                                                 ACTIVATE                        0041                                                                                                                   ACTIVATE                        0042                                2. When writing programs that will be executed in a background                     ACTIVATE                        0043                                   partition (and activated from a foreground program), note that                  ACTIVATE                        0044                                   the system variable <TERM$,#HELPMT3> equals three blank spaces                  ACTIVATE                        0045                                   in a background partition. This is a good way to check for                      ACTIVATE                        0046                                   foreground vs. background status of a partition.                                ACTIVATE                        0047                                                                                                                   ACTIVATE                        0048                              Example 1:                                                                           ACTIVATE                        0049                                                                                                                   ACTIVATE                        0050                                ACTIVATE "P09","UPDATE",DIR="DSK",EXCP=9000                                        ACTIVATE                        0051                                                                                                                   ACTIVATE                        0052                                In this example, the program named UPDATE located on directory                     ACTIVATE                        0053                                DSK is activated in partition P09.                                                 ACTIVATE                        0054                                                                                                                   ACTIVATE                        0055                                If an exception occurs when this statement is executed, the                        ACTIVATE                        0056                                program will branch to statement-label 9000. If no exception                       ACTIVATE                        0057                                occurs, the program will continue executing (and the UPDATE                        ACTIVATE                        0058                                program will begin executing in partition P09).                                    ACTIVATE                        0059                                                                                                                   ACTIVATE                        0060                              Example 2:                                                                           ACTIVATE                        0061                                                                                                                   ACTIVATE                        0062                                LENGTH 40 & COMMON DATA$                                                           ACTIVATE                        0063                                LENGTH 8.2 & COMMON VALUE1, VALUE2, VALUE3                                         ACTIVATE                        0064                                .                                                                                  ACTIVATE                        0065                                ACTIVATE "P16","REPORT",EXCP=9999                                                  ACTIVATE                        0066                                                                                                                   ACTIVATE                        0067                                In this example, the program named REPORT is activated in                          ACTIVATE                        0068                                partition P16. The <COMMON,#HELPMT3> data defined at the                           ACTIVATE                        0069                                beginning of this program is passed to the activated partition.                    ACTIVATE                        0070                                                                                                                   ACTIVATE                        0071                                If an exception occurs when this statement is executed, the                        ACTIVATE                        0072                                program will branch to statement-label 9999.                                       ACTIVATE                        0073                                                                                                                   ACTIVATE                        0074                              Example 3:                                                                           ACTIVATE                        0075                                                                                                                   ACTIVATE                        0076                                        FOR J=4 to 8                                                               ACTIVATE                        0077                                          NUMBER$=STR(J)                                                           ACTIVATE                        0078                                          PART$="P0"+NUMBER$                                                       ACTIVATE                        0079                                          ACTIVATE PART$,"UPDATE",EXCP=5000                                        ACTIVATE                        0080                                          GOTO 6000                                                                ACTIVATE                        0081                                5000    NEXT J                                                                     ACTIVATE                        0082                                        PRINT (0) "UPDATE program not activated."                                  ACTIVATE                        0083                                        GOTO 9000                                                                  ACTIVATE                        0084                                6000    PRINT (0) "UPDATE program activated in partition ";PART$                   ACTIVATE                        0085                                                                                                                   ACTIVATE                        0086                                This example demonstrates how a specific range of partitions can                   ACTIVATE                        0087                                be scanned for possible activation of a program. The control                       ACTIVATE                        0088                                variable (J) in the FOR/NEXT loop starts at 4 and advances to 8,                   ACTIVATE                        0089                                representing the partitions that will be scanned (i.e., P04                        ACTIVATE                        0090                                through P08).                                                                      ACTIVATE                        0091                                                                                                                   ACTIVATE                        0092                                For example, the first time through the loop, J will equal 4 and                   ACTIVATE                        0093                                NUMBER$ will equal the string equivalent of 4. This string value                   ACTIVATE                        0094                                is then appended to the first two characters of a partition name                   ACTIVATE                        0095                                ("P0"), forming a complete partition named of "P04".                               ACTIVATE                        0096                                                                                                                   ACTIVATE                        0097                                Next, the program attempts to activate partition P04. If the                       ACTIVATE                        0098                                activation is successful, the program branches to statement-label                  ACTIVATE                        0099                                6000 and displays a success message. If the activation is                          ACTIVATE                        0100                                unsuccessful, the program branches to statement-label 5000 (the                    ACTIVATE                        0101                                NEXT statement).                                                                   ACTIVATE                        0102                                                                                                                   ACTIVATE                        0103                                If partitions P04, P05, P06, P07, and P08 are not able to be                       ACTIVATE                        0104                                activated (possibly because they are already busy running other                    ACTIVATE                        0105                                jobs), the loop terminates and displays a failure message. The                     ACTIVATE                        0106                                program then jumps to statement-label 9000.                                        ADJUSTL/ADJUSTR                 0001                              Syntax:                                                                              ADJUSTL/ADJUSTR                 0002                                                                                                                   ADJUSTL/ADJUSTR                 0003                                ADJUSTL(string-argument)                                                           ADJUSTL/ADJUSTR                 0004                                                                                                                   ADJUSTL/ADJUSTR                 0005                                ADJUSTR(string-argument)                                                           ADJUSTL/ADJUSTR                 0006                                                                                                                   ADJUSTL/ADJUSTR                 0007                              Discussion:                                                                          ADJUSTL/ADJUSTR                 0008                                                                                                                   ADJUSTL/ADJUSTR                 0009                                The ADJUSTL and ADJUSTR functions left- and right-justify,                         ADJUSTL/ADJUSTR                 0010                                respectively, a string argument.                                                   ADJUSTL/ADJUSTR                 0011                                                                                                                   ADJUSTL/ADJUSTR                 0012                                The string argument may be a string constant, a single-element                     ADJUSTL/ADJUSTR                 0013                                string variable, a string array element, a string expression or a                  ADJUSTL/ADJUSTR                 0014                                string function.                                                                   ADJUSTL/ADJUSTR                 0015                                                                                                                   ADJUSTL/ADJUSTR                 0016                                The ADJUSTL function removes leading blanks from the string                        ADJUSTL/ADJUSTR                 0017                                argument and appends trailing blanks to retain the original                        ADJUSTL/ADJUSTR                 0018                                string argument length.                                                            ADJUSTL/ADJUSTR                 0019                                                                                                                   ADJUSTL/ADJUSTR                 0020                                The ADJUSTR function removes trailing blanks from the string                       ADJUSTL/ADJUSTR                 0021                                argument and inserts an equal number of leading blanks to retain                   ADJUSTL/ADJUSTR                 0022                                the original string argument length.                                               ADJUSTL/ADJUSTR                 0023                                                                                                                   ADJUSTL/ADJUSTR                 0024                                Note: ADJUSTL and ADJUSTR do not alter string length.                              ADJUSTL/ADJUSTR                 0025                                                                                                                   ADJUSTL/ADJUSTR                 0026                              Example 1:                                                                           ADJUSTL/ADJUSTR                 0027                                                                                                                   ADJUSTL/ADJUSTR                 0028                                A$ = ADJUSTL(B$)                                                                   ADJUSTL/ADJUSTR                 0029                                                                                                                   ADJUSTL/ADJUSTR                 0030                                If B$ = "  ABC" (notice the leading blank spaces), the ADJUSTL                     ADJUSTL/ADJUSTR                 0031                                function yields A$ = "ABC  " (notice the trailing blanks).                         ADJUSTL/ADJUSTR                 0032                                                                                                                   ADJUSTL/ADJUSTR                 0033                              Example 2:                                                                           ADJUSTL/ADJUSTR                 0034                                                                                                                   ADJUSTL/ADJUSTR                 0035                                A$ = ADJUSTR(B$)                                                                   ADJUSTL/ADJUSTR                 0036                                                                                                                   ADJUSTL/ADJUSTR                 0037                                If B$ = "ABC  " (notice the trailing blank spaces), the ADJUSTR                    ADJUSTL/ADJUSTR                 0038                                function yields A$ = "  ABC" (notice the leading blanks).                          AGAIN                           0001                              Syntax:                                                                              AGAIN                           0002                                                                                                                   AGAIN                           0003                                AGAIN                                                                              AGAIN                           0004                                                                                                                   AGAIN                           0005                              Discussion:                                                                          AGAIN                           0006                                                                                                                   AGAIN                           0007                                The AGAIN statement causes Comet to retry the last exception-                      AGAIN                           0008                                producing action.                                                                  AGAIN                           0009                                                                                                                   AGAIN                           0010                                Execution of the AGAIN statement transfers program control to the                  AGAIN                           0011                                last statement that resulted in an exception branch. If no                         AGAIN                           0012                                exception-producing action occurred, control is returned to the                    AGAIN                           0013                                first Procedure Division statement in the program.                                 AGAIN                           0014                                                                                                                   AGAIN                           0015                                Note: You cannot nest error routines and expect multiple returns                   AGAIN                           0016                                to any error-producing commands other than the most recent                         AGAIN                           0017                                occurrence.                                                                        AGAIN                           0018                              Example:                                                                             AGAIN                           0019                                                                                                                   AGAIN                           0020                                OPEN (2) "LP1",<EXCP=>PRTREXCP                                                     AGAIN                           0021                                .                                                                                  AGAIN                           0022                                .                                                                                  AGAIN                           0023                                .                                                                                  AGAIN                           0024                                PRTREXCP:    IF EXCP NE 31 THEN ERROR                                              AGAIN                           0025                                             PRINT (0) "PRINTER UNAVAILABLE."                                      AGAIN                           0026                                             PRINT (0) "PRESS TAB WHEN READY."                                     AGAIN                           0027                                             INPUT (0) ""                                                          AGAIN                           0028                                             AGAIN                                                                 AGAIN                           0029                                                                                                                   AGAIN                           0030                                In this example, the program attempts to open printer "LP1" on                     AGAIN                           0031                                logical unit number 2. If this statement produces an exception,                    AGAIN                           0032                                the program branches to label PRTREXCP, an exception handling                      AGAIN                           0033                                routine.                                                                           AGAIN                           0034                                                                                                                   AGAIN                           0035                                The routine first checks the system exception variable                             AGAIN                           0036                                <EXCP,#HELPMT3> and if it equals anything other than 31 (i.e.,                     AGAIN                           0037                                DEVICE OR DIRECTORY UNAVAILABLE), aborts the program with the                      AGAIN                           0038                                ERROR statement.                                                                   AGAIN                           0039                                                                                                                   AGAIN                           0040                                However, if EXCP equals 31, the program displays a message on the                  AGAIN                           0041                                terminal, waits for input (using the dummy input statement), and                   AGAIN                           0042                                then retries the last exception-producing action (in this case,                    AGAIN                           0043                                the OPEN statement).                                                               ASC                             0001                              Syntax:                                                                              ASC                             0002                                                                                                                   ASC                             0003                                ASC(string-argument)                                                               ASC                             0004                                                                                                                   ASC                             0005                              Discussion:                                                                          ASC                             0006                                                                                                                   ASC                             0007                                The ASC function returns the decimal value of the first byte of                    ASC                             0008                                the string-argument using the 8-bit <ASCII> code.                                  ASC                             0009                                                                                                                   ASC                             0010                                The string-argument may be a string constant, a single-element                     ASC                             0011                                string variable, a string array element, a string expression, or                   ASC                             0012                                a string function.                                                                 ASC                             0013                                                                                                                   ASC                             0014                                Note: If the string-argument contains more than one character,                     ASC                             0015                                only the first byte of the string-argument is evaluated for                        ASC                             0016                                conversion.                                                                        ASC                             0017                                                                                                                   ASC                             0018                                The resultant value for any non-null string is always a numeric                    ASC                             0019                                value from 0 through 255. The value that results for any null                      ASC                             0020                                string is always -1.                                                               ASC                             0021                                                                                                                   ASC                             0022                                The intermediate result of the ASC function is stored in an                        ASC                             0023                                accumulator with a precision of 16.0. If this intermediate result                  ASC                             0024                                is then moved into a receiving numeric variable, its precision is                  ASC                             0025                                adjusted to the defined precision of that variable.                                ASC                             0026                                                                                                                   ASC                             0027                              Example:                                                                             ASC                             0028                                                                                                                   ASC                             0029                                VALUE = ASC("SIGNATURE")                                                           ASC                             0030                                                                                                                   ASC                             0031                                In this example, the first byte of the string "SIGNATURE" (i.e.,                   ASC                             0032                                the letter "S") is converted to its decimal ASCII equivalent,                      ASC                             0033                                namely 83. This value is stored in the variable VALUE.                             ASCHEX                          0001                              Syntax:                                                                              ASCHEX                          0002                                                                                                                   ASCHEX                          0003                                ASCHEX(string-argument, numeric-error-argument)                                    ASCHEX                          0004                                                                                                                   ASCHEX                          0005                              Discussion:                                                                          ASCHEX                          0006                                                                                                                   ASCHEX                          0007                                The ASCHEX function converts an ASCII hex string to its                            ASCHEX                          0008                                equivalent <ASCII> value.                                                          ASCHEX                          0009                                                                                                                   ASCHEX                          0010                                The string-argument represents the string to be converted. Each                    ASCHEX                          0011                                two bytes of this string-argument must represent one ASCII                         ASCHEX                          0012                                character (this function provides the conversion to ASCII). The                    ASCHEX                          0013                                string-argument may be a string constant, a single-element string                  ASCHEX                          0014                                variable, a string array element, a string expression, or a                        ASCHEX                          0015                                string function.                                                                   ASCHEX                          0016                                                                                                                   ASCHEX                          0017                                The numeric-error-argument reports the success or failure of the                   ASCHEX                          0018                                conversion. It is set to 1 if there is a conversion error;                         ASCHEX                          0019                                otherwise, it is set to 0. The numeric-error-argument must be a                    ASCHEX                          0020                                single-element numeric variable or a numeric array element.                        ASCHEX                          0021                                                                                                                   ASCHEX                          0022                                If there is a conversion error (i.e., if the string-argument                       ASCHEX                          0023                                contains non-hex characters), the ASCHEX function returns a null                   ASCHEX                          0024                                result.                                                                            ASCHEX                          0025                                                                                                                   ASCHEX                          0026                                Note: The <HEXASC> function performs the opposite function of                      ASCHEX                          0027                                ASCHEX (HEXASC converts a hex string to its ASCII hex equivalent,                  ASCHEX                          0028                                character for character).                                                          ASCHEX                          0029                                                                                                                   ASCHEX                          0030                              Example:                                                                             ASCHEX                          0031                                                                                                                   ASCHEX                          0032                                VALUE$ = ASCHEX(STR$,ERR)                                                          ASCHEX                          0033                                                                                                                   ASCHEX                          0034                                In the above example, the variable STR$ contains a string of                       ASCHEX                          0035                                characters in ASCII hex form. These characters are converted to                    ASCHEX                          0036                                ASCII string form and stored in the variable VALUE$. The variable                  ASCHEX                          0037                                ERR stores a 0 or 1 to report the success of the conversion.                       ASCHEX                          0038                                                                                                                   ASCHEX                          0039                                For example, if STR$ equals "313233", VALUE$ will equal "123"                      ASCHEX                          0040                                (because "31" in hex is "1" in ASCII, etc.), and ERR will equal 0                  ASCHEX                          0041                                (indicating a successful conversion).                                              ASCHEX                          0042                                                                                                                   ASCHEX                          0043                                Or, if STR$ equals "434F4D4554", VALUE$ will equal "COMET"                         ASCHEX                          0044                                (because "43" in hex is "C" in ASCII, "4F" represents "0", etc.),                  ASCHEX                          0045                                and ERR will equal 0.                                                              ASCII                           0001  The ASCII chart             The ASCII chart                                                                      ASCII                           0002  The ASCII chart             ===============                                                                      ASCII                           0003  The ASCII chart                                                                                                  ASCII                           0004  The ASCII chart               Character    Decimal   Hex  Binary                                                 ASCII                           0005  The ASCII chart               ==================================================                                 ASCII                           0006  The ASCII chart               null         0         00   0000 0000                                              ASCII                           0007  The ASCII chart               SOH          1         01   0000 0001                                              ASCII                           0008  The ASCII chart               STX          2         02   0000 0010                                              ASCII                           0009  The ASCII chart               ETX          3         03   0000 0011                                              ASCII                           0010  The ASCII chart               EOT          4         04   0000 0100                                              ASCII                           0011  The ASCII chart               ENQ          5         05   0000 0101                                              ASCII                           0012  The ASCII chart               ACK          6         06   0000 0110                                              ASCII                           0013  The ASCII chart               BEL          7         07   0000 0111                                              ASCII                           0014  The ASCII chart               BS           8         08   0000 1000                                              ASCII                           0015  The ASCII chart               HT           9         09   0000 1001                                              ASCII                           0016  The ASCII chart               LF           10        0A   0000 1010                                              ASCII                           0017  The ASCII chart               VT           11        0B   0000 1011                                              ASCII                           0018  The ASCII chart               FF           12        0C   0000 1100                                              ASCII                           0019  The ASCII chart               CR           13        0D   0000 1101                                              ASCII                           0020  The ASCII chart               SO           14        0E   0000 1110                                              ASCII                           0021  The ASCII chart               SI           15        0F   0000 1111                                              ASCII                           0022  The ASCII chart               ======================================================                             ASCII                           0023  The ASCII chart               DLE          16        10   0001 0000                                              ASCII                           0024  The ASCII chart               DC1          17        11   0001 0001                                              ASCII                           0025  The ASCII chart               DC2          18        12   0001 0010                                              ASCII                           0026  The ASCII chart               DC3          19        13   0001 0011                                              ASCII                           0027  The ASCII chart               DC4          20        14   0001 0010                                              ASCII                           0028  The ASCII chart               NAK          21        15   0001 0011                                              ASCII                           0029  The ASCII chart               SYN          22        16   0001 0100                                              ASCII                           0030  The ASCII chart               ETB          23        17   0001 0101                                              ASCII                           0031  The ASCII chart               CAN          24        18   0001 0110                                              ASCII                           0032  The ASCII chart               EM           25        19   0001 0111                                              ASCII                           0033  The ASCII chart               SUB          26        1A   0001 1000                                              ASCII                           0034  The ASCII chart               ESC          27        1B   0001 1001                                              ASCII                           0035  The ASCII chart               FS           28        1C   0001 1010                                              ASCII                           0036  The ASCII chart               GS           29        1D   0001 1011                                              ASCII                           0037  The ASCII chart               RS           30        1E   0001 1100                                              ASCII                           0038  The ASCII chart               US           31        1F   0001 1101                                              ASCII                           0039  The ASCII chart               ======================================================                             ASCII                           0040  The ASCII chart               space        32        20   0010 0000                                              ASCII                           0041  The ASCII chart               !            33        21   0010 0001                                              ASCII                           0042  The ASCII chart               "            34        22   0010 0010                                              ASCII                           0043  The ASCII chart               #            35        23   0010 0011                                              ASCII                           0044  The ASCII chart               $            36        24   0010 0100                                              ASCII                           0045  The ASCII chart               %            37        25   0010 0101                                              ASCII                           0046  The ASCII chart               &            38        26   0010 0110                                              ASCII                           0047  The ASCII chart               '            39        27   0010 0111                                              ASCII                           0048  The ASCII chart               (            40        28   0010 1000                                              ASCII                           0049  The ASCII chart               )            41        29   0010 1001                                              ASCII                           0050  The ASCII chart               *            42        2A   0010 1010                                              ASCII                           0051  The ASCII chart               +            43        2B   0010 1011                                              ASCII                           0052  The ASCII chart               ,            44        2C   0010 1100                                              ASCII                           0053  The ASCII chart               -            45        2D   0010 1101                                              ASCII                           0054  The ASCII chart               .            46        2E   0010 1110                                              ASCII                           0055  The ASCII chart               /            47        2F   0010 1111                                              ASCII                           0056  The ASCII chart               ======================================================                             ASCII                           0057  The ASCII chart               0            48        30   0011 0000                                              ASCII                           0058  The ASCII chart               1            49        31   0011 0001                                              ASCII                           0059  The ASCII chart               2            50        32   0011 0010                                              ASCII                           0060  The ASCII chart               3            51        33   0011 0011                                              ASCII                           0061  The ASCII chart               4            52        34   0011 0100                                              ASCII                           0062  The ASCII chart               5            53        35   0011 0101                                              ASCII                           0063  The ASCII chart               6            54        36   0011 0110                                              ASCII                           0064  The ASCII chart               7            55        37   0011 0111                                              ASCII                           0065  The ASCII chart               8            56        38   0011 1000                                              ASCII                           0066  The ASCII chart               9            57        39   0011 1001                                              ASCII                           0067  The ASCII chart               :            58        3A   0011 1010                                              ASCII                           0068  The ASCII chart               ;            59        3B   0011 1011                                              ASCII                           0069  The ASCII chart                            60        3C   0011 1100  "less than" symbol *                        ASCII                           0070  The ASCII chart               =            61        3D   0011 1101                                              ASCII                           0071  The ASCII chart               >            62        3E   0011 1110                                              ASCII                           0072  The ASCII chart               ?            63        3F   0011 1111                                              ASCII                           0073  The ASCII chart               ======================================================                             ASCII                           0074  The ASCII chart               @            64        40   0100 0000                                              ASCII                           0075  The ASCII chart               A            65        41   0100 0001                                              ASCII                           0076  The ASCII chart               B            66        42   0100 0010                                              ASCII                           0077  The ASCII chart               C            67        43   0100 0011                                              ASCII                           0078  The ASCII chart               D            68        44   0100 0100                                              ASCII                           0079  The ASCII chart               E            69        45   0100 0101                                              ASCII                           0080  The ASCII chart               F            70        46   0100 0110                                              ASCII                           0081  The ASCII chart               G            71        47   0100 0111                                              ASCII                           0082  The ASCII chart               H            72        48   0100 1000                                              ASCII                           0083  The ASCII chart               I            73        49   0100 1001                                              ASCII                           0084  The ASCII chart               J            74        4A   0100 1010                                              ASCII                           0085  The ASCII chart               K            75        4B   0100 1011                                              ASCII                           0086  The ASCII chart               L            76        4C   0100 1100                                              ASCII                           0087  The ASCII chart               M            77        4D   0100 1101                                              ASCII                           0088  The ASCII chart               N            78        4E   0100 1110                                              ASCII                           0089  The ASCII chart               O            79        4F   0100 1111                                              ASCII                           0090  The ASCII chart               ======================================================                             ASCII                           0091  The ASCII chart               P            80        50   0101 0000                                              ASCII                           0092  The ASCII chart               Q            81        51   0101 0001                                              ASCII                           0093  The ASCII chart               R            82        52   0101 0010                                              ASCII                           0094  The ASCII chart               S            83        53   0101 0011                                              ASCII                           0095  The ASCII chart               T            84        54   0101 0100                                              ASCII                           0096  The ASCII chart               U            85        55   0101 0101                                              ASCII                           0097  The ASCII chart               V            86        56   0101 0110                                              ASCII                           0098  The ASCII chart               W            87        57   0101 0111                                              ASCII                           0099  The ASCII chart               X            88        58   0101 1000                                              ASCII                           0100  The ASCII chart               Y            89        59   0101 1001                                              ASCII                           0101  The ASCII chart               Z            90        5A   0101 1010                                              ASCII                           0102  The ASCII chart               [            91        5B   0101 1011                                              ASCII                           0103  The ASCII chart               \            92        5C   0101 1100                                              ASCII                           0104  The ASCII chart               ]            93        5D   0101 1101                                              ASCII                           0105  The ASCII chart               ^            94        5E   0101 1110                                              ASCII                           0106  The ASCII chart               _            95        5F   0101 1111                                              ASCII                           0107  The ASCII chart               ======================================================                             ASCII                           0108  The ASCII chart               `            96        60   0110 0000                                              ASCII                           0109  The ASCII chart               a            97        61   0110 0001                                              ASCII                           0110  The ASCII chart               b            98        62   0110 0010                                              ASCII                           0111  The ASCII chart               c            99        63   0110 0011                                              ASCII                           0112  The ASCII chart               d            100       64   0110 0100                                              ASCII                           0113  The ASCII chart               e            101       65   0110 0101                                              ASCII                           0114  The ASCII chart               f            102       66   0110 0110                                              ASCII                           0115  The ASCII chart               g            103       67   0110 0111                                              ASCII                           0116  The ASCII chart               h            104       68   0110 1000                                              ASCII                           0117  The ASCII chart               i            105       69   0110 1001                                              ASCII                           0118  The ASCII chart               j            106       6A   0110 1010                                              ASCII                           0119  The ASCII chart               k            107       6B   0110 1011                                              ASCII                           0120  The ASCII chart               l            108       6C   0110 1100                                              ASCII                           0121  The ASCII chart               m            109       6D   0110 1101                                              ASCII                           0122  The ASCII chart               n            110       6E   0110 1110                                              ASCII                           0123  The ASCII chart               o            111       6F   0110 1111                                              ASCII                           0124  The ASCII chart               ======================================================                             ASCII                           0125  The ASCII chart               p            112       70   0111 0000                                              ASCII                           0126  The ASCII chart               q            113       71   0111 0001                                              ASCII                           0127  The ASCII chart               r            114       72   0111 0010                                              ASCII                           0128  The ASCII chart               s            115       73   0111 0011                                              ASCII                           0129  The ASCII chart               t            116       74   0111 0100                                              ASCII                           0130  The ASCII chart               u            117       75   0111 0101                                              ASCII                           0131  The ASCII chart               v            118       76   0111 0110                                              ASCII                           0132  The ASCII chart               w            119       77   0111 0111                                              ASCII                           0133  The ASCII chart               x            120       78   0111 1000                                              ASCII                           0134  The ASCII chart               y            121       79   0111 1001                                              ASCII                           0135  The ASCII chart               z            122       7A   0111 1010                                              ASCII                           0136  The ASCII chart               {            123       7B   0111 1011                                              ASCII                           0137  The ASCII chart               |            124       7C   0111 1100                                              ASCII                           0138  The ASCII chart               }            125       7D   0111 1101                                              ASCII                           0139  The ASCII chart               ~            126       7E   0111 1110                                              ASCII                           0140  The ASCII chart               delete       127       7F   0111 1111                                              ASCII                           0141  The ASCII chart               ======================================================                             ASCII                           0142  The ASCII chart                                                                                                  ASCII                           0143  The ASCII chart               * Note: The "less than" symbol is a non-display character in this                  ASCII                           0144  The ASCII chart               hypertext browser and is therefore not shown in the above chart.                   BREAK                           0001                              Syntax:                                                                              BREAK                           0002                                                                                                                   BREAK                           0003                                BREAK                                                                              BREAK                           0004                                                                                                                   BREAK                           0005                              Discussion:                                                                          BREAK                           0006                                                                                                                   BREAK                           0007                                The BREAK statement stops execution of the conditional statement                   BREAK                           0008                                block within a <FOR>/NEXT structure, a <DO>/LOOP structure, or a                   BREAK                           0009                                <SELECT>/CASE structure. The BREAK statement passes control to                     BREAK                           0010                                the statement following the final statement in the structure (the                  BREAK                           0011                                <NEXT> statement, <LOOP> statement, or <ENDSELECT> statement,                      BREAK                           0012                                respectively).                                                                     BREAK                           0013                                                                                                                   BREAK                           0014                                The BREAK statement must occur between a FOR and NEXT statement,                   BREAK                           0015                                between a DO and LOOP statement, or within a <CASE> block.                         BREAK                           0016                                                                                                                   BREAK                           0017                                If a BREAK statement occurs within an IF/THEN or IF/THEN/ELSE                      BREAK                           0018                                structure, the <IF> structure must itself be within a FOR/NEXT                     BREAK                           0019                                loop, DO/LOOP structure, or CASE block, and the BREAK statement                    BREAK                           0020                                refers to the FOR, DO, or CASE structure, accordingly.                             BREAK                           0021                                                                                                                   BREAK                           0022                                There can be multiple BREAK statements within a given FOR/NEXT or                  BREAK                           0023                                DO/LOOP structure.                                                                 BREAK                           0024                                                                                                                   BREAK                           0025                              Example 1:                                                                           BREAK                           0026                                                                                                                   BREAK                           0027                                FOR I=1 TO 10          ! Start the loop                                            BREAK                           0028                                .                                                                                  BREAK                           0029                                IF A=I THEN BREAK      ! If A=I jump to end of loop                                BREAK                           0030                                .                                                                                  BREAK                           0031                                NEXT I                 ! Increment I and loop back                                 BREAK                           0032                                                                                                                   BREAK                           0033                              Example 2:                                                                           BREAK                           0034                                                                                                                   BREAK                           0035                                DO WHILE I LE 10       ! Start the loop                                            BREAK                           0036                                .                                                                                  BREAK                           0037                                IF A=I [THEN] BREAK    ! If A=I jump to end of loop                                BREAK                           0038                                .                                                                                  BREAK                           0039                                LOOP                   ! Loop back                                                 CASE                            0001                              See the <SELECT> statement.                                                          CHKSUM                          0001                              Syntax:                                                                              CHKSUM                          0002                                                                                                                   CHKSUM                          0003                                CHKSUM(string-argument)                                                            CHKSUM                          0004                                                                                                                   CHKSUM                          0005                              Discussion:                                                                          CHKSUM                          0006                                                                                                                   CHKSUM                          0007                                The CHKSUM function returns the block check character (BCC) for                    CHKSUM                          0008                                the specified string-argument.                                                     CHKSUM                          0009                                                                                                                   CHKSUM                          0010                                The string-argument may be a string constant, a single-element                     CHKSUM                          0011                                string variable, a string array element, a string expression, or                   CHKSUM                          0012                                a string function. It may be from 1 to 254 characters long.                        CHKSUM                          0013                                                                                                                   CHKSUM                          0014                                Note: The CHKSUM function uses the same check sum algorithm that                   CHKSUM                          0015                                is used by Comet's terminal protocol.                                              CHKSUM                          0016                                                                                                                   CHKSUM                          0017                              Example:                                                                             CHKSUM                          0018                                                                                                                   CHKSUM                          0019                                LENGTH 1 & LOCAL VALUE$                                                            CHKSUM                          0020                                .                                                                                  CHKSUM                          0021                                VALUE$ = CHKSUM(DATA$)                                                             CHKSUM                          0022                                                                                                                   CHKSUM                          0023                                In the above example, the CHKSUM function will return the block                    CHKSUM                          0024                                check character for the data value stored in the string variable                   CHKSUM                          0025                                DATA$. This block check character will be stored in the string                     CHKSUM                          0026                                variable VALUE$.                                                                   CHR                             0001                              Syntax:                                                                              CHR                             0002                                                                                                                   CHR                             0003                                CHR(numeric-argument)                                                              CHR                             0004                                                                                                                   CHR                             0005                              Discussion:                                                                          CHR                             0006                                                                                                                   CHR                             0007                                The CHR function returns a single-byte <ASCII> character                           CHR                             0008                                corresponding to the 8-bit binary number equivalent of the                         CHR                             0009                                numeric-argument.                                                                  CHR                             0010                                                                                                                   CHR                             0011                                The numeric-argument is a decimal value between 0 and 255,                         CHR                             0012                                inclusive. Only the absolute integer portion of the numeric                        CHR                             0013                                argument is used for the conversion; the sign and fractional                       CHR                             0014                                digits (if any) of the numeric argument are ignored.                               CHR                             0015                                                                                                                   CHR                             0016                                The numeric-argument may be a numeric constant, a single-element                   CHR                             0017                                numeric variable, a numeric array element, a numeric expression,                   CHR                             0018                                or a numeric function.                                                             CHR                             0019                                                                                                                   CHR                             0020                                If the numeric argument is greater than 255, it is reduced by                      CHR                             0021                                integer multiples of 256 until the remaining value is less than                    CHR                             0022                                256 (i.e., the numeric argument is evaluated modulo 256). This is                  CHR                             0023                                accomplished by dividing the value by 256 and retaining the                        CHR                             0024                                integer remainder. For example, 600 is evaluated as 88 (600/256                    CHR                             0025                                equals 2 with a remainder of 88). The decimal number is then                       CHR                             0026                                converted to ASCII and stored as the value of a single-byte                        CHR                             0027                                string.                                                                            CHR                             0028                                                                                                                   CHR                             0029                              Example:                                                                             CHR                             0030                                                                                                                   CHR                             0031                                VALUE$ = CHR(CODE)                                                                 CHR                             0032                                                                                                                   CHR                             0033                                In the above example, the numeric variable CODE is converted to                    CHR                             0034                                its ASCII equivalent; the resulting string byte is stored in                       CHR                             0035                                VALUE$.                                                                            CHR                             0036                                                                                                                   CHR                             0037                                For example, if CODE equals 65, the CHR function converts it to                    CHR                             0038                                the letter "A" (the ASCII value for decimal 65); this character                    CHR                             0039                                is then stored in VALUE$.                                                          CLEAR                           0001                              Syntax:                                                                              CLEAR                           0002                                                                                                                   CLEAR                           0003                                CLEAR                                                                              CLEAR                           0004                                CLEARCOMMON                                                                        CLEAR                           0005                                CLEARLOCAL                                                                         CLEAR                           0006                                                                                                                   CLEAR                           0007                              Discussion:                                                                          CLEAR                           0008                                                                                                                   CLEAR                           0009                                The CLEAR statement initializes the variables defined in the                       CLEAR                           0010                                current MTB program. String variables are initialized to null,                     CLEAR                           0011                                while numeric variables are initialized to binary zero.                            CLEAR                           0012                                                                                                                   CLEAR                           0013                                There are three forms of the CLEAR statement:                                      CLEAR                           0014                                                                                                                   CLEAR                           0015                                1. CLEAR initializes all variables defined in the program.                         CLEAR                           0016                                                                                                                   CLEAR                           0017                                2. CLEARCOMMON initializes just the <COMMON,#HELPMT3> variables                    CLEAR                           0018                                   defined in the program.                                                         CLEAR                           0019                                                                                                                   CLEAR                           0020                                   Note: The MTB compiler recognizes two versions of this                          CLEAR                           0021                                   statement, one without a space (CLEARCOMMON) and one with a                     CLEAR                           0022                                   space (CLEAR COMMON).                                                           CLEAR                           0023                                                                                                                   CLEAR                           0024                                3. CLEARLOCAL initializes just the <LOCAL,#HELPMT3> variables                      CLEAR                           0025                                   defined in the program.                                                         CLEAR                           0026                                                                                                                   CLEAR                           0027                                   Note: The MTB compiler recognizes two versions of this                          CLEAR                           0028                                   statement, one without a space (CLEARLOCAL) and one with a                      CLEAR                           0029                                   space (CLEAR LOCAL).                                                            CLEAR                           0030                                                                                                                   CLEAR                           0031                              Applications notes:                                                                  CLEAR                           0032                                                                                                                   CLEAR                           0033                                a. Many applications packages use program "overlays" to break a                    CLEAR                           0034                                   large task into smaller program segments. In these cases, one                   CLEAR                           0035                                   program will simply run another program in the same memory                      CLEAR                           0036                                   partition. This is sometimes called "chaining" of programs,                     CLEAR                           0037                                   although this document refers to this as "overlaying"                           CLEAR                           0038                                   programs.                                                                       CLEAR                           0039                                                                                                                   CLEAR                           0040                                   It is often desirable to retain data from program to program                    CLEAR                           0041                                   during the overlay process. This is most easily done with                       CLEAR                           0042                                   COMMON data variables. But, it is also desirable to initialize                  CLEAR                           0043                                   program variables with a single statement.                                      CLEAR                           0044                                                                                                                   CLEAR                           0045                                   In these cases, the CLEARLOCAL statement is the best                            CLEAR                           0046                                   alternative. It initializes just the LOCAL data variables                       CLEAR                           0047                                   (while the values stored in the COMMON variables remain                         CLEAR                           0048                                   unchanged from the preceding program running in the same                        CLEAR                           0049                                   partition).                                                                     CLEAR                           0050                                                                                                                   CLEAR                           0051                                b. You may use any number of CLEAR statements in a single                          CLEAR                           0052                                   program.                                                                        CLEAR                           0053                                                                                                                   CLEAR                           0054                                c. Sometimes, COMMON and LOCAL data variables may be used as a                     CLEAR                           0055                                   way of organizing or segregating data within a single program.                  CLEAR                           0056                                   In these cases, CLEARCOMMON or CLEARLOCAL perform                               CLEAR                           0057                                   initialization tasks for a distinct group of variables without                  CLEAR                           0058                                   affecting the other group.                                                      CLEAR                           0059                                                                                                                   CLEAR                           0060                              Example 1:                                                                           CLEAR                           0061                                                                                                                   CLEAR                           0062                                LENGTH 25 & LOCAL NAME$, ADDRESS$, CITYSTZP$                                       CLEAR                           0063                                LENGTH 8.2 & LOCAL CRLIMIT, ARTOTAL, ARCURRENT                                     CLEAR                           0064                                .                                                                                  CLEAR                           0065                                CLEAR                                                                              CLEAR                           0066                                                                                                                   CLEAR                           0067                                In the above example, the CLEAR statement initializes all of the                   CLEAR                           0068                                variables in the program, both common and local.                                   CLEAR                           0069                                                                                                                   CLEAR                           0070                              Example 2:                                                                           CLEAR                           0071                                                                                                                   CLEAR                           0072                                LENGTH 25 & LOCAL NAME$, ADDRESS$, CITYSTZP$                                       CLEAR                           0073                                LENGTH 8.2 & LOCAL CRLIMIT, ARTOTAL, ARCURRENT                                     CLEAR                           0074                                LENGTH 5 & COMMON CUSTNO$                                                          CLEAR                           0075                                LENGTH 2.0 & COMMON PAGENUM                                                        CLEAR                           0076                                .                                                                                  CLEAR                           0077                                CLEARLOCAL                                                                         CLEAR                           0078                                                                                                                   CLEAR                           0079                                In this example, the CLEARLOCAL statement initializes just the                     CLEAR                           0080                                local variables in the program. The common variables, in this                      CLEAR                           0081                                case CUSTNO$ and PAGENUM, are not initialized by the CLEARLOCAL                    CLEAR                           0082                                statement.                                                                         CLOSE                           0001                              Syntax:                                                                              CLOSE                           0002                                                                                                                   CLOSE                           0003                                CLOSE [(lun)]                                                                      CLOSE                           0004                                                                                                                   CLOSE                           0005                              Discussion:                                                                          CLOSE                           0006                                                                                                                   CLOSE                           0007                                The CLOSE statement closes a specified logical unit number, one                    CLOSE                           0008                                that was opened via a previous <OPEN> statement.                                   CLOSE                           0009                                                                                                                   CLOSE                           0010                                Once a logical unit number (<lun>) is closed, it may be                            CLOSE                           0011                                reassigned by another OPEN statement. A device that is closed by                   CLOSE                           0012                                one task is available for use by other tasks. Note that data                       CLOSE                           0013                                files are not treated as devices, therefore data files may be                      CLOSE                           0014                                opened by more than one user at a time.                                            CLOSE                           0015                                                                                                                   CLOSE                           0016                                If a task is terminated by an <END> or a <STOP> statement or is                    CLOSE                           0017                                aborted, all logical unit numbers are closed automatically.                        CLOSE                           0018                                                                                                                   CLOSE                           0019                                Likewise, the CLOSE statement without a lun closes all logical                     CLOSE                           0020                                unit numbers (including logical unit number 0).                                    CLOSE                           0021                                                                                                                   CLOSE                           0022                                The CLOSE statement is ignored if the logical unit number it                       CLOSE                           0023                                refers to was not assigned by a previous OPEN statement.                           CLOSE                           0024                                                                                                                   CLOSE                           0025                              Example 1:                                                                           CLOSE                           0026                                                                                                                   CLOSE                           0027                                OPEN (1) "LP1"                                                                     CLOSE                           0028                                .                                                                                  CLOSE                           0029                                .                                                                                  CLOSE                           0030                                .                                                                                  CLOSE                           0031                                CLOSE (1)                                                                          CLOSE                           0032                                                                                                                   CLOSE                           0033                                In this example, logical unit number 1 is opened and assigned to                   CLOSE                           0034                                the printer device named LP1. Later in the program, logical unit                   CLOSE                           0035                                number 1 is closed (and thus, LP1 is available for other                           CLOSE                           0036                                applications).                                                                     CLOSE                           0037                                                                                                                   CLOSE                           0038                              Example 2:                                                                           CLOSE                           0039                                                                                                                   CLOSE                           0040                                CLOSE (6) & OPEN (6) "WORKFILE"                                                    CLOSE                           0041                                                                                                                   CLOSE                           0042                                In this example, logical unit number 6 is first closed, then                       CLOSE                           0043                                opened and assigned to a data file named "WORKFILE." This                          CLOSE                           0044                                technique guarantees that the logical unit number is available                     CLOSE                           0045                                before the OPEN statement is executed.                                             CONTINUE                        0001                              Syntax:                                                                              CONTINUE                        0002                                                                                                                   CONTINUE                        0003                                CONTINUE                                                                           CONTINUE                        0004                                                                                                                   CONTINUE                        0005                              Discussion:                                                                          CONTINUE                        0006                                                                                                                   CONTINUE                        0007                                The CONTINUE statement passes control to the <NEXT> statement in                   CONTINUE                        0008                                a <FOR>/NEXT structure or to the <LOOP> statement in a <DO>/LOOP                   CONTINUE                        0009                                structure.                                                                         CONTINUE                        0010                                                                                                                   CONTINUE                        0011                                A CONTINUE statement must occur within a FOR/NEXT structure or a                   CONTINUE                        0012                                DO/LOOP structure.                                                                 CONTINUE                        0013                                                                                                                   CONTINUE                        0014                                If a CONTINUE statement occurs within an IF/THEN or IF/THEN/ELSE                   CONTINUE                        0015                                structure, the <IF> structure must itself be within a FOR/NEXT                     CONTINUE                        0016                                loop or DO/LOOP structure, and the CONTINUE statement refers to                    CONTINUE                        0017                                the FOR or DO structure, accordingly.                                              CONTINUE                        0018                                                                                                                   CONTINUE                        0019                                There can be multiple CONTINUE statements within a given FOR/NEXT                  CONTINUE                        0020                                or DO/LOOP structure.                                                              CONTINUE                        0021                                                                                                                   CONTINUE                        0022                              Example:                                                                             CONTINUE                        0023                                                                                                                   CONTINUE                        0024                                DO WHILE A LT 100      ! Start the loop                                            CONTINUE                        0025                                .                                                                                  CONTINUE                        0026                                   IF A=B              ! If A = B, then                                            CONTINUE                        0027                                        CONTINUE       ! jump to the LOOP statement                                CONTINUE                        0028                                   ELSE                ! otherwise                                                 CONTINUE                        0029                                   .                   ! execute these statements                                  CONTINUE                        0030                                   .                                                                               CONTINUE                        0031                                   ENDIF               ! End the IF structure                                      CONTINUE                        0032                                .                                                                                  CONTINUE                        0033                                LOOP                   ! End the DO structure                                      CREATE                          0001                              Syntax:                                                                              CREATE                          0002                                                                                                                   CREATE                          0003                                CREATE filename, record-size, file-type, [key-size,]                               CREATE                          0004                                       DIR=directory [,EXCP=statement-label]                                       CREATE                          0005                                                                                                                   CREATE                          0006                              Discussion:                                                                          CREATE                          0007                                                                                                                   CREATE                          0008                                The CREATE statement creates a new data file on a specified Comet                  CREATE                          0009                                directory.                                                                         CREATE                          0010                                                                                                                   CREATE                          0011                                The filename parameter is the name of the file to be created. It                   CREATE                          0012                                can be a string constant or a string variable, with a length up                    CREATE                          0013                                to eight characters.                                                               CREATE                          0014                                                                                                                   CREATE                          0015                                The record-size parameter defines the number of bytes in each                      CREATE                          0016                                record of the file. It may be a numeric constant or numeric                        CREATE                          0017                                variable with a maximum value of 1024. For sequential and keyed                    CREATE                          0018                                files, each record in the file has the same size. For text files,                  CREATE                          0019                                the record size is automatically set to 1024 bytes, regardless of                  CREATE                          0020                                the record-size parameter specified in the CREATE statement. For                   CREATE                          0021                                key-only files, the record-size parameter should equal 0.                          CREATE                          0022                                                                                                                   CREATE                          0023                                File-type is a one-character designator that defines the type of                   CREATE                          0024                                file being created, as follows:                                                    CREATE                          0025                                                                                                                   CREATE                          0026                                   Character Type of data file                                                     CREATE                          0027                                   ==============================                                                  CREATE                          0028                                   S         Indexed Sequential                                                    CREATE                          0029                                   K         Keyed                                                                 CREATE                          0030                                   T         Text                                                                  CREATE                          0031                                                                                                                   CREATE                          0032                                The key-size parameter, required only for keyed files, defines                     CREATE                          0033                                the number of characters in the record key (index). A maximum of                   CREATE                          0034                                64 characters is allowed.                                                          CREATE                          0035                                                                                                                   CREATE                          0036                                The directory parameter is the name of the Comet directory where                   CREATE                          0037                                the file will be created. The directory can be a string constant                   CREATE                          0038                                or a string variable, with a maximum length of three characters.                   CREATE                          0039                                                                                                                   CREATE                          0040                              Example 1:                                                                           CREATE                          0041                                                                                                                   CREATE                          0042                                CREATE "HISTFILE",500,K,20,DIR="DSK",EXCP=9999                                     CREATE                          0043                                                                                                                   CREATE                          0044                                In this example, the CREATE statement is used to create a keyed                    CREATE                          0045                                file called HISTFILE on Comet directory DSK. The file will have                    CREATE                          0046                                500 bytes in each record and 20 bytes in each key.                                 CREATE                          0047                                                                                                                   CREATE                          0048                                If an exception occurs when this statement is executed (e.g., if                   CREATE                          0049                                the file already exists), the program will branch to statement-                    CREATE                          0050                                label 9999.                                                                        CREATE                          0051                                                                                                                   CREATE                          0052                              Example 2:                                                                           CREATE                          0053                                                                                                                   CREATE                          0054                                CREATE "CUSTNAME",0,K,35,DIR="DSK",EXCP=9999                                       CREATE                          0055                                                                                                                   CREATE                          0056                                In this example, the CREATE statement is used to create a key-                     CREATE                          0057                                only file called CUSTNAME on Comet directory DSK. The file will                    CREATE                          0058                                have 0 bytes in each record and 35 bytes in each key.                              CREATE                          0059                                                                                                                   CREATE                          0060                                If an exception occurs when this statement is executed (e.g., if                   CREATE                          0061                                the file already exists), the program will branch to statement-                    CREATE                          0062                                label 9999.                                                                        CREATE                          0063                                                                                                                   CREATE                          0064                              Example 3:                                                                           CREATE                          0065                                                                                                                   CREATE                          0066                                CREATE "LOGFILE",250,S,DIR="DSK"                                                   CREATE                          0067                                                                                                                   CREATE                          0068                                In this example, the CREATE statement is used to create a                          CREATE                          0069                                sequential file called LOGFILE on Comet directory DSK. The file                    CREATE                          0070                                will have 250 bytes in each record.                                                CREATE                          0071                                                                                                                   CREATE                          0072                              Example 4:                                                                           CREATE                          0073                                                                                                                   CREATE                          0074                                CREATE "TEXTFILE",1024,T,DIR="DSK"                                                 CREATE                          0075                                                                                                                   CREATE                          0076                                In this example, the CREATE statement is used to create a text                     CREATE                          0077                                file called LOGFILE on Comet directory DSK. The file will have                     CREATE                          0078                                1024 bytes in each record.                                                         CREATE                          0079                                                                                                                   CREATE                          0080                              Example 5:                                                                           CREATE                          0081                                                                                                                   CREATE                          0082                                LENGTH 8 & LOCAL FILENAME$                                                         CREATE                          0083                                LENGTH 3 & LOCAL DIRNAME$                                                          CREATE                          0084                                .                                                                                  CREATE                          0085                                .                                                                                  CREATE                          0086                                .                                                                                  CREATE                          0087                                PRINT (0) "ENTER THE FILE NAME:"                                                   CREATE                          0088                                INPUT (0) FILENAME$                                                                CREATE                          0089                                PRINT (0) "ENTER THE DIRECTORY NAME:"                                              CREATE                          0090                                INPUT (0) DIRNAME$                                                                 CREATE                          0091                                CREATE FILENAME$,256,K,12,DIR=DIRNAME$,EXCP=8000                                   CREATE                          0092                                                                                                                   CREATE                          0093                                In this example, the user is prompted for the filename and Comet                   CREATE                          0094                                directory name (defined at the beginning of this program                           CREATE                          0095                                segment). The CREATE statement then creates a file by the name                     CREATE                          0096                                entered by the user (on the directory entered by the user). The                    CREATE                          0097                                file will be created with a record size of 256 and a key size of                   CREATE                          0098                                12.                                                                                CREATE                          0099                                                                                                                   CREATE                          0100                                If an exception occurs when this statement is executed (e.g., if                   CREATE                          0101                                the file already exists), the program will branch to statement-                    CREATE                          0102                                label 8000.                                                                        Common Parameters               0001                              Common Parameters                                                                    Common Parameters               0002                              =================                                                                    Common Parameters               0003                                                                                                                   Common Parameters               0004                                Many procedural statements in MTB make use of the same                             Common Parameters               0005                                parameters. These include the following:                                           Common Parameters               0006                                                                                                                   Common Parameters               0007                                   <logical unit number|lun>                                                       Common Parameters               0008                                   <EXCP=>exception-statement-label                                                Common Parameters               0009                                   <EXCPSUB=>exception-subroutine-label                                            Common Parameters               0010                                   <DIR=>directory                                                                 Common Parameters               0011                                   <KEY=>key-index                                                                 Copyright                       0001                              Copyright Notice                                                                     Copyright                       0002                              ================                                                                     Copyright                       0003                                                                                                                   Copyright                       0004                                This software package and documentation are copyrighted 1986-1996                  Copyright                       0005                                by Signature Systems, Inc. All rights reserved worldwide. No part                  Copyright                       0006                                of this publication may be reproduced, transmitted, transcribed,                   Copyright                       0007                                stored in any retrieval system, or translated into any language                    Copyright                       0008                                by any means without the express written permission of Signature                   Copyright                       0009                                Systems, Inc., 4325 Harrison Grade Road, Sebastopol, CA 95472.                     Copyright                       0010                                                                                                                   Copyright                       0011                              Disclaimer                                                                           Copyright                       0012                              ==========                                                                           Copyright                       0013                                                                                                                   Copyright                       0014                                Signature Systems, Inc. makes no warranties as to the contents of                  Copyright                       0015                                this documentation and specifically disclaims any implied                          Copyright                       0016                                warranties of merchantability or fitness for any particular                        Copyright                       0017                                purpose. Signature Systems further reserves the right to make                      Copyright                       0018                                changes to the specifications of the program and contents of the                   Copyright                       0019                                documentation without obligation to notify any person or                           Copyright                       0020                                organization of such changes.                                                      Copyright                       0021                                                                                                                   Copyright                       0022                              License Agreement                                                                    Copyright                       0023                              =================                                                                    Copyright                       0024                                                                                                                   Copyright                       0025                                The software described in this documentation is furnished under a                  Copyright                       0026                                license agreement and may be used or copied only in accordance                     Copyright                       0027                                with the terms of the agreement. Failure to sign this agreement                    Copyright                       0028                                and still use the software is illegal.                                             Copyright                       0029                                                                                                                   Copyright                       0030                              Trademark Credits                                                                    Copyright                       0031                              =================                                                                    Copyright                       0032                                                                                                                   Copyright                       0033                                Trademarks used in this manual belong to their respective owners.                  Copyright                       0034                                                                                                                   Copyright                       0035                              Publication Information                                                              Copyright                       0036                              =======================                                                              Copyright                       0037                                                                                                                   Copyright                       0038                                First on-line edition September 1996.                                              DATETONUM                       0001                              Syntax:                                                                              DATETONUM                       0002                                                                                                                   DATETONUM                       0003                                DATETONUM(date-string,numeric-error-argument)                                      DATETONUM                       0004                                                                                                                   DATETONUM                       0005                              Discussion:                                                                          DATETONUM                       0006                                                                                                                   DATETONUM                       0007                                The DATETONUM function converts a date-string to a 5-digit "date                   DATETONUM                       0008                                serial number."                                                                    DATETONUM                       0009                                                                                                                   DATETONUM                       0010                                The date-string is an 8-eight character string (variable or                        DATETONUM                       0011                                constant, and must be in the following form: "MMDDYYYY"                            DATETONUM                       0012                                                                                                                   DATETONUM                       0013                                The resulting "date serial number" is a 5-digit value that                         DATETONUM                       0014                                represents the number of days elapsed from a given "base date."                    DATETONUM                       0015                                The base date is January 1, 1800.                                                  DATETONUM                       0016                                                                                                                   DATETONUM                       0017                                Date string  Date serial number                                                    DATETONUM                       0018                                ==================================                                                 DATETONUM                       0019                                "01011800"            0                                                            DATETONUM                       0020                                "10152073"        99999                                                            DATETONUM                       0021                                                                                                                   DATETONUM                       0022                                This function validates calendar dates within the limits shown in                  DATETONUM                       0023                                the previous chart. If the date-string is a valid date, the                        DATETONUM                       0024                                numeric-error-argument equals 0, otherwise it equals 1.                            DATETONUM                       0025                                                                                                                   DATETONUM                       0026                                Note: This function respects the rules for leap years (i.e., the                   DATETONUM                       0027                                years 1800 and 1900 were not leap years, but the year 2000 is a                    DATETONUM                       0028                                leap year).                                                                        DATETONUM                       0029                                                                                                                   DATETONUM                       0030                                Also see <NUMTODATE>.                                                              DATETONUM                       0031                                                                                                                   DATETONUM                       0032                              Example:                                                                             DATETONUM                       0033                                                                                                                   DATETONUM                       0034                                LENGTH   8 & LOCAL VALUE$                                                          DATETONUM                       0035                                LENGTH 5.0 & LOCAL SERIAL                                                          DATETONUM                       0036                                LENGTH 1.0 & LOCAL ERRARG                                                          DATETONUM                       0037                                .                                                                                  DATETONUM                       0038                                PRINT (0) "ENTER A DATE STRING (MMDDYYYY):"                                        DATETONUM                       0039                                INPUT (0) VALUE$                                                                   DATETONUM                       0040                                IF VALUE$ = "" THEN RUN "QMONITOR"                                                 DATETONUM                       0041                                SERIAL = DATETONUM(VALUE$,ERRARG)                                                  DATETONUM                       0042                                PRINT (0) "THE DATE SERIAL NUMBER IS:";SERIAL                                      DATETONUM                       0043                                PRINT (0) "THE ERROR ARGUMENT IS:";ERRARG                                          DECHEX                          0001                              Syntax:                                                                              DECHEX                          0002                                                                                                                   DECHEX                          0003                                DECHEX(numeric-argument, numeric-error-argument)                                   DECHEX                          0004                                                                                                                   DECHEX                          0005                              Discussion:                                                                          DECHEX                          0006                                                                                                                   DECHEX                          0007                                The DECHEX function converts a decimal number to its hexadecimal                   DECHEX                          0008                                string equivalent.                                                                 DECHEX                          0009                                                                                                                   DECHEX                          0010                                The numeric-argument represents the value to be converted. It may                  DECHEX                          0011                                be a constant or variable. The value of the numeric-argument may                   DECHEX                          0012                                not exceed 65,535 (i.e., hex "@FFFF@"). The numeric-argument may                   DECHEX                          0013                                be a numeric constant, a single-element numeric variable, a                        DECHEX                          0014                                numeric array element, a numeric expression, or a numeric                          DECHEX                          0015                                function.                                                                          DECHEX                          0016                                                                                                                   DECHEX                          0017                                The numeric-error-argument reports the success or failure of the                   DECHEX                          0018                                conversion. It is set to 1 if there is a conversion error;                         DECHEX                          0019                                otherwise, it is set to 0. The numeric-error-argument must be a                    DECHEX                          0020                                single-element numeric variable or a numeric array element.                        DECHEX                          0021                                                                                                                   DECHEX                          0022                              Example:                                                                             DECHEX                          0023                                                                                                                   DECHEX                          0024                                X$ = DECHEX(NUM,ERR)                                                               DECHEX                          0025                                                                                                                   DECHEX                          0026                                In the above example, the value of the numeric variable NUM is                     DECHEX                          0027                                used to establish the equivalent hex string and the resulting                      DECHEX                          0028                                value is stored in X$. The variable ERR reports on the success or                  DECHEX                          0029                                failure of the conversion.                                                         DECHEX                          0030                                                                                                                   DECHEX                          0031                                For example, if NUM equals 255, X$ will equal "@FF@" (the hex                      DECHEX                          0032                                equivalent of 255), and ERR will equal 0 (indicating a successful                  DECHEX                          0033                                conversion).                                                                       DECHEX                          0034                                                                                                                   DECHEX                          0035                                Or, if NUM equals 12,345, X$ will equal "@3039@" (the hex                          DECHEX                          0036                                equivalent of 12,345), and ERR will equal 0.                                       DECHEX                          0037                                                                                                                   DELETE                          0001                              Syntax:                                                                              DELETE                          0002                                                                                                                   DELETE                          0003                                DELETE (lun) KEY=index [,EXCP=statement-label]                                     DELETE                          0004                                                                                                                   DELETE                          0005                              Discussion:                                                                          DELETE                          0006                                                                                                                   DELETE                          0007                                The DELETE statement deletes an existing record from a                             DELETE                          0008                                <keyed file|Keyed Files,#HELPMT2>.                                                 DELETE                          0009                                                                                                                   DELETE                          0010                                The <lun> parameter defines which file the record being deleted                    DELETE                          0011                                from (i.e., the file opened under that lun in a previous <OPEN>                    DELETE                          0012                                statement).                                                                        DELETE                          0013                                                                                                                   DELETE                          0014                                The index parameter defines the index and associated record being                  DELETE                          0015                                deleted. The index may be a string constant, a single-element                      DELETE                          0016                                string variable, a string array element, a string expression, or                   DELETE                          0017                                a string function.                                                                 DELETE                          0018                                                                                                                   DELETE                          0019                                When the DELETE statement is executed, it automatically advances                   DELETE                          0020                                the file pointer to the next available record in sequential (key)                  DELETE                          0021                                order, marks the record for deletion, and removes the specified                    DELETE                          0022                                key from the key list.                                                             DELETE                          0023                                                                                                                   DELETE                          0024                              Example 1:                                                                           DELETE                          0025                                                                                                                   DELETE                          0026                                DELETE (3) KEY="ABC-123",EXCP=5000                                                 DELETE                          0027                                                                                                                   DELETE                          0028                                In this example, a record is deleted from the file opened on                       DELETE                          0029                                logical unit number 3. The key containing "ABC-123" specifies the                  DELETE                          0030                                record to be deleted from the file. If an exception occurs when                    DELETE                          0031                                this statement is executed (e.g., if the key doesn't exist in the                  DELETE                          0032                                file), the program will branch to statement-label 5000.                            DELETE                          0033                                                                                                                   DELETE                          0034                              Example 2:                                                                           DELETE                          0035                                                                                                                   DELETE                          0036                                PRINT (0) "ENTER KEY TO DELETE:"                                                   DELETE                          0037                                INPUT (0) KEYVALUE$                                                                DELETE                          0038                                DELETE (1) KEY=KEYVALUE$,EXCP=9999                                                 DELETE                          0039                                                                                                                   DELETE                          0040                                In this example, the user is prompted for a specific key value.                    DELETE                          0041                                The response is then used to determine which key and record will                   DELETE                          0042                                be deleted from the file opened on logical unit number 1.                          DELETE                          0043                                                                                                                   DIR=                            0001  Directory name              Directory name                                                                       DIR=                            0002  Directory name              ==============                                                                       DIR=                            0003  Directory name              Parameter:                                                                           DIR=                            0004  Directory name                                                                                                   DIR=                            0005  Directory name                DIR=directory                                                                      DIR=                            0006  Directory name                                                                                                   DIR=                            0007  Directory name              Discussion:                                                                          DIR=                            0008  Directory name                                                                                                   DIR=                            0009  Directory name                This parameter is used in input/output statements to specify a                     DIR=                            0010  Directory name                Comet directory name.                                                              DIR=                            0011  Directory name                                                                                                   DIR=                            0012  Directory name              Example 1:                                                                           DIR=                            0013  Directory name                                                                                                   DIR=                            0014  Directory name                <OPEN> (1) "CUSTMAST", DIR="DSK"                                                   DIR=                            0015  Directory name                                                                                                   DIR=                            0016  Directory name                In this example, the program attempts to open a file named                         DIR=                            0017  Directory name                "CUSTMAST" located on a directory named "DSK".                                     DIR=                            0018  Directory name                                                                                                   DIR=                            0019  Directory name              Example 2:                                                                           DIR=                            0020  Directory name                                                                                                   DIR=                            0021  Directory name                <CREATE> "WORKFILE",1024,K,64,DIR="RAM"                                            DIR=                            0022  Directory name                                                                                                   DIR=                            0023  Directory name                In this example, the program attempts to create a keyed file                       DIR=                            0024  Directory name                named "WORKFILE" on a directory named "RAM". The file will have a                  DIR=                            0025  Directory name                record size of 1024 bytes and a key size of 64 bytes.                              DO                              0001                              Syntax:                                                                              DO                              0002                                                                                                                   DO                              0003                                DO {WHILE | UNTIL} relational-expression                                           DO                              0004                                [conditional statement block]                                                      DO                              0005                                LOOP                                                                               DO                              0006                                                                                                                   DO                              0007                                (or)                                                                               DO                              0008                                                                                                                   DO                              0009                                DO                                                                                 DO                              0010                                [statement block]                                                                  DO                              0011                                LOOP {WHILE | UNTIL} relational-expression                                         DO                              0012                                                                                                                   DO                              0013                                (or)                                                                               DO                              0014                                                                                                                   DO                              0015                                DO                                                                                 DO                              0016                                [statement block]                                                                  DO                              0017                                LOOP                                                                               DO                              0018                                                                                                                   DO                              0019                              Discussion:                                                                          DO                              0020                                                                                                                   DO                              0021                                The DO and LOOP statements execute a block of code repeatedly,                     DO                              0022                                either (1) while a specified condition is true, or (2) until a                     DO                              0023                                specified condition is true.                                                       DO                              0024                                                                                                                   DO                              0025                                The relational expression may be any expression containing                         DO                              0026                                relational operations such that it can be evaluated as true or                     DO                              0027                                false. (For more information, see the <IF>/THEN discussion.)                       DO                              0028                                                                                                                   DO                              0029                                DO/WHILE will evaluate the relational expression and execute the                   DO                              0030                                statement block if the expression is true. At the LOOP statement,                  DO                              0031                                control returns to the expression evaluation.                                      DO                              0032                                                                                                                   DO                              0033                                DO/UNTIL functions in the same manner, except that the code is                     DO                              0034                                executed if the expression is not true. In both cases, the                         DO                              0035                                evaluation of the expression is at the top of the loop.                            DO                              0036                                                                                                                   DO                              0037                                DO followed by LOOP/WHILE or LOOP/UNTIL causes the statement                       DO                              0038                                block to be executed at least once, no matter whether the                          DO                              0039                                expression is true or false. The test occurs at the bottom of the                  DO                              0040                                loop, and the statement block is executed again if the expression                  DO                              0041                                is true, for the WHILE case, or false, for the UNTIL case.                         DO                              0042                                                                                                                   DO                              0043                                DO/LOOP with no conditional clause should be used with care. The                   DO                              0044                                test that determines whether the loop should be executed or not                    DO                              0045                                must occur in the code itself using the BREAK statement.                           DO                              0046                                                                                                                   DO                              0047                              Example 1:                                                                           DO                              0048                                                                                                                   DO                              0049                                DO WHILE TOTQUAN LT LIMIT                                                          DO                              0050                                   TOTQUAN=TOTQUAN+QUAN                                                            DO                              0051                                   GOSUB GETNXT                                                                    DO                              0052                                LOOP                                                                               DO                              0053                                                                                                                   DO                              0054                                Whenever TOTQUAN is greater than or equal to LIMIT, control will                   DO                              0055                                pass immediately to the statement following the LOOP statement.                    DO                              0056                                                                                                                   DO                              0057                                The same result will occur if the first statement is:                              DO                              0058                                                                                                                   DO                              0059                                   DO UNTIL TOTQUAN GE LIMIT                                                       DO                              0060                                                                                                                   DO                              0061                              Example 2:                                                                           DO                              0062                                                                                                                   DO                              0063                                DO                                                                                 DO                              0064                                   TOTQUAN=TOTQUAN+QUAN                                                            DO                              0065                                   GOSUB GETNXT                                                                    DO                              0066                                LOOP WHILE TOTQUAN LT LIMIT                                                        DO                              0067                                                                                                                   DO                              0068                                (or)                                                                               DO                              0069                                                                                                                   DO                              0070                                LOOP UNTIL TOTQUAN GE LIMIT                                                        DO                              0071                                                                                                                   DO                              0072                                In this example, the statement block is executed at least once.                    DO                              0073                                                                                                                   DO                              0074                              Example 3:                                                                           DO                              0075                                                                                                                   DO                              0076                                DO                                                                                 DO                              0077                                .                                                                                  DO                              0078                                IF X=25 [THEN] BREAK                                                               DO                              0079                                .                                                                                  DO                              0080                                LOOP                                                                               DO                              0081                                                                                                                   DO                              0082                                In this example, the loop is terminated if the variable X equals                   DO                              0083                                25.                                                                                DO                              0084                                                                                                                   DO                              0085                              Additional discussion:                                                               DO                              0086                                                                                                                   DO                              0087                                The DO/LOOP structure encompasses several specialized keywords,                    DO                              0088                                including DO, LOOP, WHILE, UNTIL, BREAK, and CONTINUE. Of these,                   DO                              0089                                only two are required to define a loop:  the DO statement at the                   DO                              0090                                beginning and the LOOP statement at the ending.                                    DO                              0091                                                                                                                   DO                              0092                                Thus, a simple DO loop would look like this:                                       DO                              0093                                                                                                                   DO                              0094                                   DO                                                                              DO                              0095                                   [statement block]                                                               DO                              0096                                   LOOP                                                                            DO                              0097                                                                                                                   DO                              0098                                This structure defines an "endless" loop, and should be used with                  DO                              0099                                care. The code to terminate such a loop would be contained in the                  DO                              0100                                statement block and would include the <BREAK> statement as a way                   DO                              0101                                to end the loop (more on this below).                                              DO                              0102                                                                                                                   DO                              0103                                A more common approach is to include conditions for the loop. MTB                  DO                              0104                                accomplishes this with the WHILE and UNTIL clauses. While most                     DO                              0105                                structured languages include these clauses for the DO statement                    DO                              0106                                only, we've implemented them for the DO statement and the LOOP                     DO                              0107                                statement. If you use a conditional clause on the DO statement,                    DO                              0108                                the condition is evaluated at the top of the loop. If you use a                    DO                              0109                                conditional clause on the LOOP statement, the condition is                         DO                              0110                                evaluated at the bottom of the loop, meaning that the statement                    DO                              0111                                block will be executed at least once. Note that a conditional                      DO                              0112                                clause may be used either with the DO statement or with the LOOP                   DO                              0113                                statement, but not with both statements in the same structure.                     DO                              0114                                                                                                                   DO                              0115                                For example, the WHILE clause can be used with the DO statement                    DO                              0116                                as follows:                                                                        DO                              0117                                                                                                                   DO                              0118                                   DO WHILE relational-expression                                                  DO                              0119                                   [conditional statement block]                                                   DO                              0120                                   LOOP                                                                            DO                              0121                                                                                                                   DO                              0122                                The conditional statement block will be executed as long as the                    DO                              0123                                relational expression is true. When the relational expression is                   DO                              0124                                false, the program will branch to the first statement following                    DO                              0125                                the LOOP statement.                                                                DO                              0126                                                                                                                   DO                              0127                                On the other hand, the UNTIL clause will cause the execution of                    DO                              0128                                the conditional statement block as long as the relational-                         DO                              0129                                expression is false. When the relational expression is true, the                   DO                              0130                                program will branch to the first statement following the LOOP                      DO                              0131                                statement. The UNTIL syntax is:                                                    DO                              0132                                                                                                                   DO                              0133                                   DO UNTIL relational-expression                                                  DO                              0134                                   [conditional statement block]                                                   DO                              0135                                   LOOP                                                                            DO                              0136                                                                                                                   DO                              0137                                As an alternative, either conditional clause may be used on the                    DO                              0138                                LOOP statement, as follows:                                                        DO                              0139                                                                                                                   DO                              0140                                   DO                                                                              DO                              0141                                   [statement block]                                                               DO                              0142                                   LOOP WHILE relational-expression                                                DO                              0143                                                                                                                   DO                              0144                                   (or)                                                                            DO                              0145                                                                                                                   DO                              0146                                   DO                                                                              DO                              0147                                   [statement block]                                                               DO                              0148                                   LOOP UNTIL relational-expression                                                DO                              0149                                                                                                                   DO                              0150                                In both of these cases, the statement block will be executed at                    DO                              0151                                least once; the loop test is performed at the bottom of the loop.                  DO                              0152                                                                                                                   DO                              0153                                Two program control statements can be used to modify the                           DO                              0154                                statement execution sequence in a DO/LOOP structure. These                         DO                              0155                                statements are BREAK and CONTINUE. The BREAK statement stops                       DO                              0156                                execution of the conditional statement block within and passes                     DO                              0157                                control to the statement following the LOOP statement. For                         DO                              0158                                example:                                                                           DO                              0159                                                                                                                   DO                              0160                                   DO WHILE I LE 10                                                                DO                              0161                                   .                                                                               DO                              0162                                   .                                                                               DO                              0163                                   IF A=I [THEN] BREAK      ! jump out of the loop                                 DO                              0164                                   .                                                                               DO                              0165                                   .                                                                               DO                              0166                                   LOOP                                                                            DO                              0167                                                                                                                   DO                              0168                                The CONTINUE statement passes control to the LOOP statement in a                   DO                              0169                                DO/LOOP structure. For example:                                                    DO                              0170                                                                                                                   DO                              0171                                   DO WHILE A LT 100                                                               DO                              0172                                   .                                                                               DO                              0173                                   .                                                                               DO                              0174                                   IF A=B                                                                          DO                              0175                                        CONTINUE            ! branch to the LOOP statement                         DO                              0176                                   ELSE                                                                            DO                              0177                                   .                                                                               DO                              0178                                   .                                                                               DO                              0179                                   ENDIF                                                                           DO                              0180                                   .                                                                               DO                              0181                                   .                                                                               DO                              0182                                   LOOP                                                                            DO                              0183                                                                                                                   DO                              0184                                Note:  The BREAK and CONTINUE statements may also be used in the                   DO                              0185                                FOR/NEXT structure. BREAK passes control to the statement                          DO                              0186                                following the NEXT statement, while CONTINUE passes control to                     DO                              0187                                the NEXT statement.                                                                DO                              0188                                                                                                                   DO                              0189                                In addition, the BREAK statement may be used in the <SELECT>/CASE                  DO                              0190                                structure.                                                                         DOSFC                           0001                              Syntax:                                                                              DOSFC                           0002                                                                                                                   DOSFC                           0003                                DOSFC(string-1, string-2, string-3)                                                DOSFC                           0004                                     [,EXCP=statement-label]                                                       DOSFC                           0005                                                                                                                   DOSFC                           0006                              See <DOS Function Calls,#HELPMT5> for a complete discussion of this                  DOSFC                           0007                              statement.                                                                           DOSMS                           0001                              Syntax:                                                                              DOSMS                           0002                                                                                                                   DOSMS                           0003                                DOSMS(string-1,string-2,string-3,string-4)                                         DOSMS                           0004                                     [,EXCP=statement-label]                                                       DOSMS                           0005                                                                                                                   DOSMS                           0006                              See <DOS Function Calls,#HELPMT5> for a complete discussion of this                  DOSMS                           0007                              statement.                                                                           DOSRW                           0001                              Syntax:                                                                              DOSRW                           0002                                                                                                                   DOSRW                           0003                                DOSRW(string-1,string-2,numeric-argument,format-label)                             DOSRW                           0004                                     [,EXCP=statement-label]                                                       DOSRW                           0005                                                                                                                   DOSRW                           0006                              See <DOS Function Calls,#HELPMT5> for a complete discussion of this                  DOSRW                           0007                              statement.                                                                           DSTAT                           0001                              Syntax:                                                                              DSTAT                           0002                                                                                                                   DSTAT                           0003                                DSTAT(device-name [,EXCP=statement-label])                                         DSTAT                           0004                                                                                                                   DSTAT                           0005                              Discussion:                                                                          DSTAT                           0006                                                                                                                   DSTAT                           0007                                The DSTAT function returns the current status of system devices.                   DSTAT                           0008                                                                                                                   DSTAT                           0009                                The device-name is the name of the device to be checked. The                       DSTAT                           0010                                device-name may be a string constant, a single-element string                      DSTAT                           0011                                variable, a string array element, a string expression, or a                        DSTAT                           0012                                string function.                                                                   DSTAT                           0013                                                                                                                   DSTAT                           0014                              Detailed information:                                                                DSTAT                           0015                                                                                                                   DSTAT                           0016                                <DSTAT of the console>                                                             DSTAT                           0017                                <DSTAT of remote terminals>                                                        DSTAT                           0018                                <DSTAT of a local printer>                                                         DSTAT                           0019                                <DSTAT of a remote printer>                                                        DSTAT                           0020                                <DSTAT of a spooler>                                                               DSTAT                           0021                                <DSTAT of the system device (X00)>                                                 DSTAT                           0022                                <DSTAT of a gateway>                                                               DSTAT                           0023                                <DSTAT of a directory>                                                             DSTAT                           0024                                <DSTAT of the clock>                                                               DSTAT of a directory            0001                              DSTAT of a directory                                                                 DSTAT of a directory            0002                                                                                                                   DSTAT of a directory            0003                              Position  Length    Description                                                      DSTAT of a directory            0004                              ======================================                                               DSTAT of a directory            0005                              1         3         Directory name                                                   DSTAT of a directory            0006                              4         27        DOS path name                                                    DSTAT of a gateway              0001                              DSTAT of a gateway                                                                   DSTAT of a gateway              0002                                                                                                                   DSTAT of a gateway              0003                              Position  Length    Description                                                      DSTAT of a gateway              0004                              =============================================                                        DSTAT of a gateway              0005                              1         3         Controlling partition                                            DSTAT of a gateway              0006                              4         1         Gateway type (hex)                                               DSTAT of a gateway              0007                              5         1         Gateway subtype (hex)                                            DSTAT of a local printer        0001                              DSTAT of a local printer                                                             DSTAT of a local printer        0002                                                                                                                   DSTAT of a local printer        0003                              Position  Length    Description                                                      DSTAT of a local printer        0004                              =================================================================                    DSTAT of a local printer        0005                              1         3         Partition                                                        DSTAT of a local printer        0006                              4         1         Type                                                             DSTAT of a local printer        0007                              5         1         Spool Type                                                       DSTAT of a local printer        0008                              6         1         Status                                                           DSTAT of a local printer        0009                              7         2         Printer Port                                                     DSTAT of a local printer        0010                              9         2         Buffer Count (convert to decimal for use)                        DSTAT of a local printer        0011                              11        30        Path                                                             DSTAT of a remote printer       0001                              DSTAT of a remote printer                                                            DSTAT of a remote printer       0002                                                                                                                   DSTAT of a remote printer       0003                              Position  Length    Description                                                      DSTAT of a remote printer       0004                              =========================================                                            DSTAT of a remote printer       0005                              1         3         Partition                                                        DSTAT of a remote printer       0006                              4         1         Type                                                             DSTAT of a remote printer       0007                              5         1         Spool Type                                                       DSTAT of a remote printer       0008                              6         1         Status                                                           DSTAT of a remote printer       0009                              7         1         UART                                                             DSTAT of a remote printer       0010                              8         1         Poll Address                                                     DSTAT of a remote printer       0011                              9         1         Terminal Flag                                                    DSTAT of a remote printer       0012                              10        1         Terminal Process                                                 DSTAT of a remote printer       0013                              11        1         ROM Version                                                      DSTAT of a spooler              0001                              DSTAT of a spooler                                                                   DSTAT of a spooler              0002                                                                                                                   DSTAT of a spooler              0003                              Position  Length    Description                                                      DSTAT of a spooler              0004                              =====================================                                                DSTAT of a spooler              0005                              1         27        DOS path name                                                    DSTAT of remote terminals       0001                              DSTAT for remote terminals                                                           DSTAT of remote terminals       0002                                                                                                                   DSTAT of remote terminals       0003                              Position  Length    Description/Values                                               DSTAT of remote terminals       0004                              ===================================================================                  DSTAT of remote terminals       0005                              1         3         Partition                                                        DSTAT of remote terminals       0006                              4         1         Type                                                             DSTAT of remote terminals       0007                                                  80H = dumb terminal                                              DSTAT of remote terminals       0008                                                  81H = TeleVideo terminal                                         DSTAT of remote terminals       0009                                                  82H = Ampex terminal                                             DSTAT of remote terminals       0010                                                  83H = Qantel VT3 terminal                                        DSTAT of remote terminals       0011                                                  84H = Qantel VT6 terminal                                        DSTAT of remote terminals       0012                                                  86H = QTerm workstation                                          DSTAT of remote terminals       0013                                                  F0H = Intermec bar code reader                                   DSTAT of remote terminals       0014                                                  FEH = RDI printer                                                DSTAT of remote terminals       0015                                                  FFH = ignored terminal                                           DSTAT of remote terminals       0016                              5         1         not used                                                         DSTAT of remote terminals       0017                              6         1         Status                                                           DSTAT of remote terminals       0018                              7         1         UART                                                             DSTAT of remote terminals       0019                              8         1         Poll address                                                     DSTAT of remote terminals       0020                              9         1         Terminal flag                                                    DSTAT of remote terminals       0021                                                                                                                   DSTAT of remote terminals       0022                                                  80H  OBP Terminal Lockout (Signal to PC that FG                  DSTAT of remote terminals       0023                                                       processing loop is active on this terminal                  DSTAT of remote terminals       0024                                                       and effectively locks out PC from changing                  DSTAT of remote terminals       0025                                                       anything in the term table.)                                DSTAT of remote terminals       0026                                                                                                                   DSTAT of remote terminals       0027                                                  20H  Status Poll Hold Request (PC signals don't                  DSTAT of remote terminals       0028                                                       do status poll on this terminal.)                           DSTAT of remote terminals       0029                                                                                                                   DSTAT of remote terminals       0030                                                  10H  Select Request (OBP should initiate a                       DSTAT of remote terminals       0031                                                       select poll (data is in the buffer)                         DSTAT of remote terminals       0032                                                                                                                   DSTAT of remote terminals       0033                                                  08H  Buffer In Use Flag (OBP should not                          DSTAT of remote terminals       0034                                                       initiate a data poll)                                       DSTAT of remote terminals       0035                                                                                                                   DSTAT of remote terminals       0036                                                  04H  Data Poll Ack Request (PC has received the                  DSTAT of remote terminals       0037                                                       data and the buffer is clear)                               DSTAT of remote terminals       0038                                                                                                                   DSTAT of remote terminals       0039                                                  02H  Reset Request (user has hit Escape)                         DSTAT of remote terminals       0040                                                                                                                   DSTAT of remote terminals       0041                                                  01H  Data Poll Request                                           DSTAT of remote terminals       0042                                                                                                                   DSTAT of remote terminals       0043                              10        1         Terminal process                                                 DSTAT of remote terminals       0044                                                                                                                   DSTAT of remote terminals       0045                                                  Foreground Attention Needed                                      DSTAT of remote terminals       0046                                                  0  = IDLE - Dead terminal                                        DSTAT of remote terminals       0047                                                  1  = IDLE - Active terminal                                      DSTAT of remote terminals       0048                                                  2  = Status Poll Complete                                        DSTAT of remote terminals       0049                                                  8  = Waiting to send buffer to PC                                DSTAT of remote terminals       0050                                                  9  = Finished select - OK                                        DSTAT of remote terminals       0051                                                  A  = Finished select - NG                                        DSTAT of remote terminals       0052                                                  B  = Data poll complete (ACK included)                           DSTAT of remote terminals       0053                                                                                                                   DSTAT of remote terminals       0054                                                  UART is Working on this one                                      DSTAT of remote terminals       0055                                                  10H  = Doing status poll                                         DSTAT of remote terminals       0056                                                  11H  = Receiving data from terminal                              DSTAT of remote terminals       0057                                                  12H  = Sending data to terminal                                  DSTAT of remote terminals       0058                                                  13H  = Retransmitting to terminal (1st                           DSTAT of remote terminals       0059                                                  retransmit)                                                      DSTAT of remote terminals       0060                                                  14H  = Retransmitting to terminal (2nd                           DSTAT of remote terminals       0061                                                  retransmit)                                                      DSTAT of remote terminals       0062                                                  15H  = Terminal reset in progress                                DSTAT of the clock              0001                              DSTAT of the clock                                                                   DSTAT of the clock              0002                                                                                                                   DSTAT of the clock              0003                              Position  Length    Description                                                      DSTAT of the clock              0004                              ===================================                                                  DSTAT of the clock              0005                              1         3         Clock name                                                       DSTAT of the console            0001                              DSTAT of the console                                                                 DSTAT of the console            0002                                                                                                                   DSTAT of the console            0003                              Position  Length    Description/Values                                               DSTAT of the console            0004                              ===================================================================                  DSTAT of the console            0005                              1         3         Partition                                                        DSTAT of the console            0006                              4         1         Type                                                             DSTAT of the console            0007                                                  0 = Monochrome                                                   DSTAT of the console            0008                                                  1 = Color                                                        DSTAT of the console            0009                                                  2 = Monochrome with flicker-free adapter                         DSTAT of the console            0010                                                  3 = Color with flicker-free adapter                              DSTAT of the console            0011                                                  4 = EGA/VGA/MCGA Monochrome                                      DSTAT of the console            0012                                                  5 = EGA/VGA/MCGA Color                                           DSTAT of the console            0013                                                  6 = TeleVideo                                                    DSTAT of the console            0014                                                  7 = AT&T                                                         DSTAT of the console            0015                              5         1         Option                                                           DSTAT of the console            0016                                                  01H = Force 80-column mode                                       DSTAT of the console            0017                                                  02H = Force CR the same as Qantel                                DSTAT of the console            0018                                                  04H = Auto increment cursor                                      DSTAT of the console            0019                                                  08H = FAST option enabled for all files                          DSTAT of the console            0020                                                  10H = Insert key is the same as Qantel                           DSTAT of the console            0021                                                  20H = Use expanded memory for all partitions                     DSTAT of the console            0022                                                  40H = Standard I/O for keyboard                                  DSTAT of the console            0023                              6         1         Status                                                           DSTAT of the console            0024                              7         1         Foreground attribute                                             DSTAT of the console            0025                              8         1         Background attribute                                             DSTAT of the console            0026                              9         1         Invisible attribute                                              DSTAT of the console            0027                              10        1         Border attribute                                                 DSTAT of the console            0028                              11        1         Entry attribute                                                  DSTAT of the console            0029                              12        2         Base address                                                     DSTAT of the console            0030                              14        2         Current column and row                                           DSTAT of the console            0031                              16        1         BIOS mode for 132-column                                         DSTAT of the console            0032                              17        1         Current number of columns on screen                              DSTAT of the system device (X00)0001                              DSTAT of the system device (X00)                                                     DSTAT of the system device (X00)0002                                                                                                                   DSTAT of the system device (X00)0003                              Position  Length    Description                                                      DSTAT of the system device (X00)0004                              =========================================                                            DSTAT of the system device (X00)0005                              1         16        Network node name                                                ELSE                            0001                              See <IF/THEN/ELSE/ENDIF|IF>.                                                         END                             0001                              Syntax:                                                                              END                             0002                                                                                                                   END                             0003                                END                                                                                END                             0004                                                                                                                   END                             0005                              Discussion:                                                                          END                             0006                                                                                                                   END                             0007                                The END statement serves two purposes. First, the END statement                    END                             0008                                signals the MTB compiler to stop compiling the current program                     END                             0009                                (even if there are additional source program lines following the                   END                             0010                                END statement). Therefore, END should be placed as the last                        END                             0011                                physical line in an MTB source program.                                            END                             0012                                                                                                                   END                             0013                                   Note: If you omit the END statement from a source program, it                   END                             0014                                   is automatically inserted by the MTB compiler as the last                       END                             0015                                   instruction in the object program.                                              END                             0016                                                                                                                   END                             0017                                Second, when the END statement is executed at runtime, it                          END                             0018                                initiates a termination procedure that closes all open logical                     END                             0019                                unit numbers and runs the QENDITOR utility program.                                END                             0020                                                                                                                   END                             0021                                See <STOP>.                                                                        END                             0022                                                                                                                   END                             0023                              Example:                                                                             END                             0024                                                                                                                   END                             0025                                LENGTH 2 & LOCAL FLAG$                                                             END                             0026                                LENGTH 5 & LOCAL CUSTNO$                                                           END                             0027                                .                                                                                  END                             0028                                100 FORMAT (ET);(CS)                                                               END                             0029                                .                                                                                  END                             0030                                CLEAR                                                                              END                             0031                                OPEN (1) "C1A", EXCP=9000                                                          END                             0032                                .                                                                                  END                             0033                                END                                                                                END                             0034                                                                                                                   END                             0035                                This example shows that the END statement is the last physical                     END                             0036                                line in a source program.                                                          ENDIF                           0001                              See the <IF> statement.                                                              ENDSELECT                       0001                              See the <SELECT> statement.                                                          ENTER                           0001                              Syntax:                                                                              ENTER                           0002                                                                                                                   ENTER                           0003                                ENTER program [,DIR=directory] [,EXCP=statement-label]                             ENTER                           0004                                                                                                                   ENTER                           0005                              Discussion:                                                                          ENTER                           0006                                                                                                                   ENTER                           0007                                The ENTER statement executes a <subprogram|Subprograms,#HELPMT2>.                  ENTER                           0008                                                                                                                   ENTER                           0009                                ENTER operates like a <RUN> statement except that the specified                    ENTER                           0010                                program is an MTB subprogram.                                                      ENTER                           0011                                                                                                                   ENTER                           0012                                When an ENTER statement is executed, the partition environment of                  ENTER                           0013                                the current program is saved and the specified program is loaded                   ENTER                           0014                                and executed in the same partition.                                                ENTER                           0015                                                                                                                   ENTER                           0016                                Comet saves the partition environment as a disk file. Initially,                   ENTER                           0017                                Comet searches for a local RAM disk among the accessed Comet                       ENTER                           0018                                directories, and if one is found, saves the partition environment                  ENTER                           0019                                there. If no local RAM drive is found, Comet saves the partition                   ENTER                           0020                                environment on the current DOS directory.                                          ENTER                           0021                                                                                                                   ENTER                           0022                                Since a RAM drive is faster than a hard drive, we recommend                        ENTER                           0023                                configuring one in your Comet system if you plan to use the ENTER                  ENTER                           0024                                statement. (Note: The Comet Help System makes extensive use of                     ENTER                           0025                                the ENTER statement, so we recommend a RAM drive if you plan to                    ENTER                           0026                                use the help system.)                                                              ENTER                           0027                                                                                                                   ENTER                           0028                                The partition environment is passed in full to the called                          ENTER                           0029                                subprogram. This includes the data division (<COMMON> and <LOCAL>                  ENTER                           0030                                fields) and the open logical unit numbers. If the data division                    ENTER                           0031                                of the subprogram is structured exactly the same as the calling                    ENTER                           0032                                program, data values are preserved when the subprogram is                          ENTER                           0033                                executed. (Data values are not preserved, however, when the                        ENTER                           0034                                subprogram is concluded -- see the next page for more                              ENTER                           0035                                information.)                                                                      ENTER                           0036                                                                                                                   ENTER                           0037                                In addition, when the ENTER statement is executed, Comet                           ENTER                           0038                                increments the "open count" for all open logical unit numbers in                   ENTER                           0039                                the original program. This protects the files associated with                      ENTER                           0040                                these logical unit numbers (for example, it makes it impossible                    ENTER                           0041                                for another user to erase a file which was opened in the original                  ENTER                           0042                                program and subsequently closed in the subprogram).                                ENTER                           0043                                                                                                                   ENTER                           0044                                The called subprogram must conclude with an <EXIT> or <EXITALL>                    ENTER                           0045                                statement. When an EXIT statement is executed by the subprogram,                   ENTER                           0046                                the partition environment is restored to its previous state and                    ENTER                           0047                                the calling program continues executing at the next instruction                    ENTER                           0048                                following the ENTER statement. In this regard, the ENTER and EXIT                  ENTER                           0049                                statements are very similar to the <GOSUB> and <RETURN>                            ENTER                           0050                                statements, respectively.                                                          ENTER                           0051                                                                                                                   ENTER                           0052                                When Comet restores the partition environment, it does so using                    ENTER                           0053                                the disk file (or RAM drive file) created when the ENTER                           ENTER                           0054                                statement was executed. All data values, formats, and                              ENTER                           0055                                instructions are restored to their original (pre-subprogram)                       ENTER                           0056                                values. Thus, data is not automatically passed back to the                         ENTER                           0057                                calling program.                                                                   ENTER                           0058                                                                                                                   ENTER                           0059                                However, a subprogram can pass data back to the calling program                    ENTER                           0060                                via the user record buffer (#). The subprogram can write a record                  ENTER                           0061                                to the user record buffer and execute an EXIT instruction. Then,                   ENTER                           0062                                the calling program can read the contents of the user record                       ENTER                           0063                                buffer to retrieve the data passed back from the subprogram.                       ENTER                           0064                                                                                                                   ENTER                           0065                                Upon executing an EXIT or EXITALL instruction, Comet decrements                    ENTER                           0066                                the "open count" for the program's logical unit numbers. This                      ENTER                           0067                                returns the logical unit numbers to their original status.                         ENTER                           0068                                                                                                                   ENTER                           0069                                The partition environment files are erased when Comet is                           ENTER                           0070                                terminated.                                                                        ENTER                           0071                                                                                                                   ENTER                           0072                                Subprograms may be nested up to 99 levels. Each ENTER statement                    ENTER                           0073                                calls another level of subprogram, and each EXIT statement                         ENTER                           0074                                returns to the previous level. The EXITALL statement returns to                    ENTER                           0075                                the original calling program (i.e., the top level).                                ENTER                           0076                                                                                                                   ENTER                           0077                                A system variable, <ENTERLEVEL,#HELPMT3> (numeric, 2.0), contains                  ENTER                           0078                                a value equal to the relative subprogram level of the program                      ENTER                           0079                                currently executing. If ENTERLEVEL equals zero, the current                        ENTER                           0080                                program is not a subprogram (i.e., it was RUN, not ENTERed).                       ENTER                           0081                                Values greater than zero equal the number of ENTER operations                      ENTER                           0082                                used to execute the current program (i.e., the nesting depth).                     ENTER                           0083                                                                                                                   ENTER                           0084                              Example:                                                                             ENTER                           0085                                                                                                                   ENTER                           0086                                Calling program             Subprogram ("SUBPROG" on "DSK")                        ENTER                           0087                                =========================   ===============================                        ENTER                           0088                                .                           .                                                      ENTER                           0089                                .                           .                                                      ENTER                           0090                                .                           .                                                      ENTER                           0091                                ENTER "SUBPROG",DIR="DSK"   .                                                      ENTER                           0092                                .                           .                                                      ENTER                           0093                                .                           .                                                      ENTER                           0094                                .                           EXIT                                                   ENTER                           0095                                                                                                                   ENTER                           0096                                This example shows the relationship between a calling program and                  ENTER                           0097                                a subprogram. In this example, the calling program executes (via                   ENTER                           0098                                the ENTER statement) the subprogram named "SUBPROG" from the                       ENTER                           0099                                Comet directory named "DSK". The final statement in the                            ENTER                           0100                                subprogram (EXIT) returns control to the calling program at the                    ENTER                           0101                                statement immediately following the ENTER statement.                               ERASE                           0001                              Syntax:                                                                              ERASE                           0002                                                                                                                   ERASE                           0003                                ERASE filename [,DIR=directory] [,EXCP=statement-label]                            ERASE                           0004                                                                                                                   ERASE                           0005                              Discussion:                                                                          ERASE                           0006                                                                                                                   ERASE                           0007                                The ERASE statement removes a specified file from a Comet                          ERASE                           0008                                directory.                                                                         ERASE                           0009                                                                                                                   ERASE                           0010                                Filename is the name of the file to be erased. It may be a string                  ERASE                           0011                                constant or string variable.                                                       ERASE                           0012                                                                                                                   ERASE                           0013                                Directory (optional) is the name of the Comet directory where the                  ERASE                           0014                                file is located. If this parameter is not included, Comet will                     ERASE                           0015                                search the accessed directories in accessed order in an attempt                    ERASE                           0016                                to find the file. The first filename found matching the filename                   ERASE                           0017                                to be erased will be erased.                                                       ERASE                           0018                                                                                                                   ERASE                           0019                                Note: A file must be closed by all users to be erased.                             ERASE                           0020                                                                                                                   ERASE                           0021                              Example 1:                                                                           ERASE                           0022                                                                                                                   ERASE                           0023                                ERASE "OLDFILE",EXCP=9999                                                          ERASE                           0024                                                                                                                   ERASE                           0025                                In this example, the file named OLDFILE will be erased. (The                       ERASE                           0026                                accessed directories will be searched in order for this file.)                     ERASE                           0027                                If an exception occurs, the program will branch to statement-                      ERASE                           0028                                label 9999.                                                                        ERASE                           0029                                                                                                                   ERASE                           0030                              Example 2:                                                                           ERASE                           0031                                                                                                                   ERASE                           0032                                ERASE FILENAME$,DIR=DIRNAME$,EXCP=8000                                             ERASE                           0033                                                                                                                   ERASE                           0034                                In this example, the ERASE statement is used with variable names                   ERASE                           0035                                for the filename and directory. Values for these variables must                    ERASE                           0036                                be established before this statement is executed.                                  ERROR                           0001                              Syntax:                                                                              ERROR                           0002                                                                                                                   ERROR                           0003                                ERROR                                                                              ERROR                           0004                                                                                                                   ERROR                           0005                              Discussion:                                                                          ERROR                           0006                                                                                                                   ERROR                           0007                                The ERROR statement invokes a non-recoverable runtime error                        ERROR                           0008                                termination procedure. It is typically used as an escape path for                  ERROR                           0009                                unanticipated runtime exceptions in an exception routine.                          ERROR                           0010                                                                                                                   ERROR                           0011                                Execution of the ERROR statement closes all logical unit numbers,                  ERROR                           0012                                terminates program execution and runs QENDITOR (the Comet runtime                  ERROR                           0013                                error utility program) to display error-diagnostic information on                  ERROR                           0014                                the controlling terminal.                                                          ERROR                           0015                                                                                                                   ERROR                           0016                              Example:                                                                             ERROR                           0017                                                                                                                   ERROR                           0018                                READ (1,1000) KEY=CUSTNUM$, <EXCP=>BRANCH1                                         ERROR                           0019                                .                                                                                  ERROR                           0020                                BRANCH1:     IF EXCP=33 THEN ...                                                   ERROR                           0021                                             IF EXCP=32 THEN ...                                                   ERROR                           0022                                             ERROR                                                                 ERROR                           0023                                                                                                                   ERROR                           0024                                In the above example, an exception routine is established at the                   ERROR                           0025                                statement label BRANCH1. In this routine, the Comet system                         ERROR                           0026                                variable <EXCP,#HELPMT3> is interrogated. If its value is 33                       ERROR                           0027                                (indicating that a data record is extracted by another user) or                    ERROR                           0028                                32 (indicating that the particular key was not found in the                        ERROR                           0029                                file), specific actions are taken (although not shown in the                       ERROR                           0030                                above program segment).                                                            ERROR                           0031                                                                                                                   ERROR                           0032                                However, if the value if EXCP is anything other than 33 or 32,                     ERROR                           0033                                the program executes the ERROR statement and terminates execution                  ERROR                           0034                                of the program.                                                                    ERRORSUB                        0001                              Syntax:                                                                              ERRORSUB                        0002                                                                                                                   ERRORSUB                        0003                                ERRORSUB statement-label                                                           ERRORSUB                        0004                                                                                                                   ERRORSUB                        0005                                (or)                                                                               ERRORSUB                        0006                                                                                                                   ERRORSUB                        0007                                ERRORSUB [SYSTEM]                                                                  ERRORSUB                        0008                                                                                                                   ERRORSUB                        0009                              Discussion:                                                                          ERRORSUB                        0010                                                                                                                   ERRORSUB                        0011                                The ERRORSUB statement sets a default exception branch. The                        ERRORSUB                        0012                                statement-label is the label of an exception routine that will be                  ERRORSUB                        0013                                executed if a runtime exception occurs that is not handled by an                   ERRORSUB                        0014                                exception path (i.e., by an <EXCP=> or <EXCPSUB=> exception                        ERRORSUB                        0015                                trap).                                                                             ERRORSUB                        0016                                                                                                                   ERRORSUB                        0017                                ERRORSUB SYSTEM may be specified to clear the ERRORSUB statement                   ERRORSUB                        0018                                currently in effect.                                                               ERRORSUB                        0019                                                                                                                   ERRORSUB                        0020                                ERRORSUB is similar to the ERRORTO statement, but provides for                     ERRORSUB                        0021                                easier program handling because, like a normal subroutine call,                    ERRORSUB                        0022                                the next statement address is placed in the users's subroutine                     ERRORSUB                        0023                                stack. When a <RETURN> is encountered after the ERRORSUB                           ERRORSUB                        0024                                statement is executed, program execution continues at the                          ERRORSUB                        0025                                statement immediately following the statement that produced the                    ERRORSUB                        0026                                exception, and the return address is popped off the stack. Use of                  ERRORSUB                        0027                                ERRORSUB lets program flow continue smoothly, without requiring                    ERRORSUB                        0028                                the programmer to determine where the exception occurred and                       ERRORSUB                        0029                                hence where the program should continue.                                           ERRORSUB                        0030                                                                                                                   ERRORSUB                        0031                                The statement-label is automatically cleared after execution, and                  ERRORSUB                        0032                                unless it is reset by another ERRORSUB statement, subsequent un-                   ERRORSUB                        0033                                trapped runtime exceptions will initiate the QENDITOR program.                     ERRORSUB                        0034                                                                                                                   ERRORSUB                        0035                                Note: ERRORSUB and <ERRORTO> are mutually exclusive; only one can                  ERRORSUB                        0036                                be active at a time. The latest one that is executed is the one                    ERRORSUB                        0037                                in effect.                                                                         ERRORSUB                        0038                                                                                                                   ERRORSUB                        0039                              Example:                                                                             ERRORSUB                        0040                                                                                                                   ERRORSUB                        0041                                ERRORSUB 9999                                                                      ERRORSUB                        0042                                .                                                                                  ERRORSUB                        0043                                READ (1,1000)                                                                      ERRORSUB                        0044                                PRINT (2,2000)                                                                     ERRORSUB                        0045                                .                                                                                  ERRORSUB                        0046                                9999 IF EXCP NE 33 THEN ERROR                                                      ERRORSUB                        0047                                     RETURN                                                                        ERRORSUB                        0048                                                                                                                   ERRORSUB                        0049                                In the above example, the default exception subroutine is                          ERRORSUB                        0050                                established at statement 9999. If the READ statement encounters                    ERRORSUB                        0051                                an exception, the program branches to 9999, where the system                       ERRORSUB                        0052                                variable EXCP is interrogated. If EXCP is not equal to 33                          ERRORSUB                        0053                                (indicating "record extracted"), the program executes the ERROR                    ERRORSUB                        0054                                termination procedure. Otherwise the program returns to the                        ERRORSUB                        0055                                statement following the exception (in this case, the PRINT                         ERRORSUB                        0056                                statement).                                                                        ERRORTO                         0001                              Syntax:                                                                              ERRORTO                         0002                                                                                                                   ERRORTO                         0003                                ERRORTO statement-label                                                            ERRORTO                         0004                                                                                                                   ERRORTO                         0005                                (or)                                                                               ERRORTO                         0006                                                                                                                   ERRORTO                         0007                                ERRORTO [SYSTEM]                                                                   ERRORTO                         0008                                                                                                                   ERRORTO                         0009                              Discussion:                                                                          ERRORTO                         0010                                                                                                                   ERRORTO                         0011                                The ERRORTO statement sets a default exception branch. The                         ERRORTO                         0012                                statement-label is the label of an exception routine that will be                  ERRORTO                         0013                                executed if a runtime exception occurs that is not handled by an                   ERRORTO                         0014                                exception path (i.e., by an <EXCP=> or <EXCPSUB=> exception                        ERRORTO                         0015                                trap).                                                                             ERRORTO                         0016                                                                                                                   ERRORTO                         0017                                ERRORTO SYSTEM may be specified to clear the ERRORTO statement                     ERRORTO                         0018                                currently in effect.                                                               ERRORTO                         0019                                                                                                                   ERRORTO                         0020                                The statement-label is automatically cleared after execution, and                  ERRORTO                         0021                                unless it is reset by another ERRORTO statement, subsequent un-                    ERRORTO                         0022                                trapped runtime exceptions will initiate the QENDITOR program.                     ERRORTO                         0023                                                                                                                   ERRORTO                         0024                                The ERRORTO statement does not affect the GOSUB stack.                             ERRORTO                         0025                                                                                                                   ERRORTO                         0026                                Note: <ERRORSUB> and ERRORTO are mutually exclusive; only one can                  ERRORTO                         0027                                be active at a time. The latest one that is executed is the one                    ERRORTO                         0028                                in effect.                                                                         ERRORTO                         0029                                                                                                                   ERRORTO                         0030                              Example:                                                                             ERRORTO                         0031                                                                                                                   ERRORTO                         0032                                ERRORTO 9999                                                                       ERRORTO                         0033                                .                                                                                  ERRORTO                         0034                                OPEN (1) "FILE123"                                                                 ERRORTO                         0035                                .                                                                                  ERRORTO                         0036                                9999 IF EXCP=11 THEN RUN "QMONITOR"                                                ERRORTO                         0037                                     ERROR                                                                         ERRORTO                         0038                                                                                                                   ERRORTO                         0039                                In the above example, the default exception routine is set at                      ERRORTO                         0040                                statement 9999. Subsequent un-trapped runtime exceptions will                      ERRORTO                         0041                                cause the program to branch to statement 9999, where the Comet                     ERRORTO                         0042                                system variable EXCP is interrogated. If EXCP equals 11                            ERRORTO                         0043                                (indicating "file not found"), the program will run QMONITOR.                      ERRORTO                         0044                                Otherwise it will initiate the ERROR termination procedure.                        ESCAPESUB                       0001                              Syntax:                                                                              ESCAPESUB                       0002                                                                                                                   ESCAPESUB                       0003                                ESCAPESUB statement-label                                                          ESCAPESUB                       0004                                                                                                                   ESCAPESUB                       0005                                (or)                                                                               ESCAPESUB                       0006                                                                                                                   ESCAPESUB                       0007                                ESCAPESUB SYSTEM                                                                   ESCAPESUB                       0008                                                                                                                   ESCAPESUB                       0009                              Discussion:                                                                          ESCAPESUB                       0010                                                                                                                   ESCAPESUB                       0011                                The ESCAPESUB statement sets a default escape subroutine to the                    ESCAPESUB                       0012                                specified statement-label. This routine will be executed if the                    ESCAPESUB                       0013                                F3 key (escape) is pressed during program execution. Since the                     ESCAPESUB                       0014                                escape routine is a true subroutine, the <RETURN> statement can                    ESCAPESUB                       0015                                be executed from the escape routine to return to the main section                  ESCAPESUB                       0016                                of the program. Note: Subroutines may be nested to 8 levels.                       ESCAPESUB                       0017                                                                                                                   ESCAPESUB                       0018                                ESCAPESUB SYSTEM resets the escape condition. Once it is                           ESCAPESUB                       0019                                executed, pressing F3/TRANSMIT will escape from the program to                     ESCAPESUB                       0020                                the QMONITOR program. When ESCAPESUB is used with no parameters                    ESCAPESUB                       0021                                it is treated as ESCAPESUB SYSTEM.                                                 ESCAPESUB                       0022                                                                                                                   ESCAPESUB                       0023                                Application note: Use ESCAPESUB at the beginning of a program                      ESCAPESUB                       0024                                that needs protection from an operator escape. Also note that                      ESCAPESUB                       0025                                whenever an escape is performed and the escape subroutine is                       ESCAPESUB                       0026                                executed, the ESCAPESUB must be reset before it will execute                       ESCAPESUB                       0027                                again.                                                                             ESCAPESUB                       0028                                                                                                                   ESCAPESUB                       0029                                Also see <ESCAPETO>.                                                               ESCAPESUB                       0030                                                                                                                   ESCAPESUB                       0031                              Example:                                                                             ESCAPESUB                       0032                                                                                                                   ESCAPESUB                       0033                                ESCAPESUB 9999                                                                     ESCAPESUB                       0034                                .                                                                                  ESCAPESUB                       0035                                .                                                                                  ESCAPESUB                       0036                                .                                                                                  ESCAPESUB                       0037                                9999    ESCAPESUB 9999                                                             ESCAPESUB                       0038                                        RETURN                                                                     ESCAPESUB                       0039                                                                                                                   ESCAPESUB                       0040                                In the above example, the ESCAPESUB statement is used at the                       ESCAPESUB                       0041                                beginning of the Procedure Division to set a default escape                        ESCAPESUB                       0042                                subroutine to statement 9999.                                                      ESCAPESUB                       0043                                                                                                                   ESCAPESUB                       0044                                During subsequent program execution, pressing the F3 key will                      ESCAPESUB                       0045                                cause the program to branch to statement 9999 (where the                           ESCAPESUB                       0046                                ESCAPESUB statement is immediately reset to branch to 9999; the                    ESCAPESUB                       0047                                subroutine also returns processing to the main section of the                      ESCAPESUB                       0048                                program).                                                                          ESCAPETO                        0001                              Syntax:                                                                              ESCAPETO                        0002                                                                                                                   ESCAPETO                        0003                                ESCAPETO statement-label                                                           ESCAPETO                        0004                                                                                                                   ESCAPETO                        0005                                (or)                                                                               ESCAPETO                        0006                                                                                                                   ESCAPETO                        0007                                ESCAPETO SYSTEM                                                                    ESCAPETO                        0008                                                                                                                   ESCAPETO                        0009                              Discussion:                                                                          ESCAPETO                        0010                                                                                                                   ESCAPETO                        0011                                The ESCAPETO statement sets a default escape routine to the                        ESCAPETO                        0012                                specified statement-label. This routine will be executed if the                    ESCAPETO                        0013                                F3 key (escape) is pressed during program execution.                               ESCAPETO                        0014                                                                                                                   ESCAPETO                        0015                                ESCAPETO SYSTEM resets the escape condition. Once it is executed,                  ESCAPETO                        0016                                pressing F3/TRANSMIT will escape from the program to the QMONITOR                  ESCAPETO                        0017                                program. When ESCAPETO is used with no parameters it is treated                    ESCAPETO                        0018                                as ESCAPETO SYSTEM.                                                                ESCAPETO                        0019                                                                                                                   ESCAPETO                        0020                                Application note: Use ESCAPETO at the beginning of a program that                  ESCAPETO                        0021                                needs protection from an operator escape. Also note that whenever                  ESCAPETO                        0022                                an escape is performed and the escape routine is executed, the                     ESCAPETO                        0023                                ESCAPETO must be reset before it will execute again.                               ESCAPETO                        0024                                                                                                                   ESCAPETO                        0025                                Also see <ESCAPESUB>.                                                              ESCAPETO                        0026                                                                                                                   ESCAPETO                        0027                              Example:                                                                             ESCAPETO                        0028                                                                                                                   ESCAPETO                        0029                                ESCAPETO 9999                                                                      ESCAPETO                        0030                                .                                                                                  ESCAPETO                        0031                                5000 .....     ! Main program return point                                         ESCAPETO                        0032                                .                                                                                  ESCAPETO                        0033                                9999    ESCAPETO 9999                                                              ESCAPETO                        0034                                        PRINT (0) "PROGRAM INTERRUPTION -- F3 PRESSED."                            ESCAPETO                        0035                                        PRINT (0) "DO YOU WISH TO CONTINUE (Y/N)?"                                 ESCAPETO                        0036                                        INPUT (0) ANSWER$                                                          ESCAPETO                        0037                                        IF ANSWER$ = "Y" THEN GOTO 5000                                            ESCAPETO                        0038                                        RUN "QMONITOR"                                                             ESCAPETO                        0039                                                                                                                   ESCAPETO                        0040                                In the above example, the ESCAPETO statement is used at the                        ESCAPETO                        0041                                beginning of the Procedure Division to set a default escape                        ESCAPETO                        0042                                routine to statement 9999.                                                         ESCAPETO                        0043                                                                                                                   ESCAPETO                        0044                                During subsequent program execution, pressing the F3 key will                      ESCAPETO                        0045                                cause the program to branch to statement 9999 (where the ESCAPETO                  ESCAPETO                        0046                                statement is immediately reset to branch to 9999); the routine                     ESCAPETO                        0047                                then prints a message acknowledging that F3 has been pressed and                   ESCAPETO                        0048                                prompts the user to continue or end the program.                                   ESCAPETO                        0049                                                                                                                   ESCAPETO                        0050                                If the user enters "Y" in response to the prompt, the program                      ESCAPETO                        0051                                will branch back to statement 5000 (which is not necessarily the                   ESCAPETO                        0052                                place where the user pressed the F3 key). Otherwise, the program                   ESCAPETO                        0053                                will terminate and run "QMONITOR".                                                 EXCP=                           0001  Exception path              Exception path                                                                       EXCP=                           0002  Exception path              ==============                                                                       EXCP=                           0003  Exception path              Parameter:                                                                           EXCP=                           0004  Exception path                                                                                                   EXCP=                           0005  Exception path                EXCP=exception-statement-label                                                     EXCP=                           0006  Exception path                                                                                                   EXCP=                           0007  Exception path              Discussion:                                                                          EXCP=                           0008  Exception path                                                                                                   EXCP=                           0009  Exception path                Used in input/output statements to specify the statement-label                     EXCP=                           0010  Exception path                where program control is transferred if an exception occurs. For                   EXCP=                           0011  Exception path                more information, see <Exception Handling>.                                        EXCP=                           0012  Exception path                                                                                                   EXCP=                           0013  Exception path                If an exception occurs, the program will branch to the statement-                  EXCP=                           0014  Exception path                label specified. At that statement label, the program may contain                  EXCP=                           0015  Exception path                statements to inquire into the nature of the exception.                            EXCP=                           0016  Exception path                                                                                                   EXCP=                           0017  Exception path                Also see <EXCPSUB=>.                                                               EXCP=                           0018  Exception path                                                                                                   EXCP=                           0019  Exception path              Example:                                                                             EXCP=                           0020  Exception path                                                                                                   EXCP=                           0021  Exception path                        OPEN (1) "CUSTFILE", EXCP=LABEL1        ! OPEN FILE                        EXCP=                           0022  Exception path                        .                                                                          EXCP=                           0023  Exception path                        INPUT (0) CUSTNUM$                      ! ENTER CUST. NO.                  EXCP=                           0024  Exception path                        READ (1,1000) KEY=CUSTNUM$, EXCP=LABEL2 ! READ RECORD                      EXCP=                           0025  Exception path                        .                                                                          EXCP=                           0026  Exception path                LABEL1: IF EXCP = 11 THEN ...         ! FILE NOT FOUND EXCEPTION                   EXCP=                           0027  Exception path                        .                                                                          EXCP=                           0028  Exception path                LABEL2: IF EXCP = 32 THEN ...         ! KEY NOT FOUND EXCEPTION                    EXCP=                           0029  Exception path                        IF EXCP = 33 THEN ...         ! RECORD LOCKED EXCEPTION                    EXCP=                           0030  Exception path                                                                                                   EXCP=                           0031  Exception path                In this example, the <OPEN> statement attempts to open a file                      EXCP=                           0032  Exception path                named "CUSTFILE". If an exception occurs, the program branches to                  EXCP=                           0033  Exception path                LABEL1:, where the system variable named EXCP is interrogated. If                  EXCP=                           0034  Exception path                the EXCP variable equals 11, Comet was not able to find the data                   EXCP=                           0035  Exception path                file (most likely because such a file name did not exist).                         EXCP=                           0036  Exception path                                                                                                   EXCP=                           0037  Exception path                The <READ> statement attempts to read a record from the customer                   EXCP=                           0038  Exception path                file with a key value equal to the input value (i.e., the                          EXCP=                           0039  Exception path                customer number). If an exception occurs, the program branches to                  EXCP=                           0040  Exception path                LABEL2:, where the system variable named EXCP is interrogated.                     EXCP=                           0041  Exception path                                                                                                   EXCP=                           0042  Exception path                   If EXCP equals 32, the specified customer number key was not                    EXCP=                           0043  Exception path                   found in the file.                                                              EXCP=                           0044  Exception path                                                                                                   EXCP=                           0045  Exception path                   If EXCP equals 33, the specified customer number key was                        EXCP=                           0046  Exception path                   locked (extracted) by another user.                                             EXCP=                           0047  Exception path                                                                                                   EXCP=                           0048  Exception path                See <system variables,#HELPMT3> and <EXCP,#HELPMT3> for more                       EXCP=                           0049  Exception path                information.                                                                       EXCPSUB=                        0001  Exception subroutine        Exception subroutine                                                                 EXCPSUB=                        0002  Exception subroutine        ====================                                                                 EXCPSUB=                        0003  Exception subroutine        Parameter:                                                                           EXCPSUB=                        0004  Exception subroutine                                                                                             EXCPSUB=                        0005  Exception subroutine          EXCPSUB=exception-subroutine-label                                                 EXCPSUB=                        0006  Exception subroutine                                                                                             EXCPSUB=                        0007  Exception subroutine        Discussion:                                                                          EXCPSUB=                        0008  Exception subroutine                                                                                             EXCPSUB=                        0009  Exception subroutine          If an exception occurs, the program will branch to the subroutine                  EXCPSUB=                        0010  Exception subroutine          statement-label specified. At that label, the program may contain                  EXCPSUB=                        0011  Exception subroutine          statements to inquire into the nature of the exception. This                       EXCPSUB=                        0012  Exception subroutine          exception routine may include a <RETURN> statement to branch back                  EXCPSUB=                        0013  Exception subroutine          to the main program (i.e., the exception routine is really a                       EXCPSUB=                        0014  Exception subroutine          subroutine).                                                                       EXCPSUB=                        0015  Exception subroutine                                                                                             EXCPSUB=                        0016  Exception subroutine          For more information, see <Exception Handling>.                                    EXCPSUB=                        0017  Exception subroutine                                                                                             EXCPSUB=                        0018  Exception subroutine          Also see <EXCP=>.                                                                  EXIT                            0001                              Syntax:                                                                              EXIT                            0002                                                                                                                   EXIT                            0003                                EXIT [,EXCP=statement-label]                                                       EXIT                            0004                                                                                                                   EXIT                            0005                              Discussion:                                                                          EXIT                            0006                                                                                                                   EXIT                            0007                                The EXIT statement returns control to a calling program.                           EXIT                            0008                                                                                                                   EXIT                            0009                                See the information about <Subprograms,#HELPMT2>.                                  EXIT                            0010                                                                                                                   EXIT                            0011                                All subprograms invoked by an <ENTER> statement must ultimately                    EXIT                            0012                                terminate with an EXIT or <EXITALL> statement to return control                    EXIT                            0013                                to the calling program. The EXIT statement returns control to the                  EXIT                            0014                                previous calling program, while the EXITALL statement returns                      EXIT                            0015                                control to the top-level calling program (in the case of multi-                    EXIT                            0016                                level subprograms).                                                                EXIT                            0017                                                                                                                   EXIT                            0018                                A subprogram may execute overlay programs via the <RUN>                            EXIT                            0019                                statement, in which case the final overlay must execute an EXIT                    EXIT                            0020                                or EXITALL statement to return to the calling program.                             EXIT                            0021                                                                                                                   EXIT                            0022                                If an EXIT statement is executed without a prior ENTER statement                   EXIT                            0023                                having been executed, Comet returns an exception 66. By adding an                  EXIT                            0024                                exception path to the EXIT statement, program flow can be                          EXIT                            0025                                directed to a routine that tests for exception 66 and then RUNs                    EXIT                            0026                                the subsequent program overlay.                                                    EXIT                            0027                                                                                                                   EXIT                            0028                              Example 1:                                                                           EXIT                            0029                                                                                                                   EXIT                            0030                                Calling program             Subprogram ("SUBPROG" on "DSK")                        EXIT                            0031                                =========================   ===============================                        EXIT                            0032                                .                           .                                                      EXIT                            0033                                .                           .                                                      EXIT                            0034                                .                           .                                                      EXIT                            0035                                ENTER "SUBPROG",DIR="DSK"   .                                                      EXIT                            0036                                .                           .                                                      EXIT                            0037                                .                           .                                                      EXIT                            0038                                .                           EXIT                                                   EXIT                            0039                                                                                                                   EXIT                            0040                                This example shows the relationship between a calling program and                  EXIT                            0041                                a subprogram. In this example, the calling program executes (via                   EXIT                            0042                                the ENTER statement) the subprogram named "SUBPROG" from the                       EXIT                            0043                                Comet directory named "DSK". The final statement in the                            EXIT                            0044                                subprogram (EXIT) returns control to the calling program at the                    EXIT                            0045                                statement immediately following the ENTER statement.                               EXIT                            0046                                                                                                                   EXIT                            0047                              Example 2:                                                                           EXIT                            0048                                                                                                                   EXIT                            0049                                        EXIT, EXCP=LABEL1                                                          EXIT                            0050                                        .                                                                          EXIT                            0051                                LABEL1: IF EXCP = 66 THEN RUN "PROGRAM"                                            EXIT                            0052                                                                                                                   EXIT                            0053                                This example shows how an exception path can be written for the                    EXIT                            0054                                EXIT statement. If an exception occurs when the EXIT statement is                  EXIT                            0055                                executed, the program will branch to LABEL1:, where the system                     EXIT                            0056                                variable <EXCP,#HELPMT3> is interrogated.                                          EXITALL                         0001                              Syntax:                                                                              EXITALL                         0002                                                                                                                   EXITALL                         0003                                EXITALL                                                                            EXITALL                         0004                                                                                                                   EXITALL                         0005                              Discussion:                                                                          EXITALL                         0006                                                                                                                   EXITALL                         0007                                The EXITALL statement returns control to a top-level calling                       EXITALL                         0008                                program.                                                                           EXITALL                         0009                                                                                                                   EXITALL                         0010                                See the information about <Subprograms,#HELPMT2>.                                  EXITALL                         0011                                                                                                                   EXITALL                         0012                                All subprograms invoked by an <ENTER> statement must ultimately                    EXITALL                         0013                                terminate with an <EXIT> or EXITALL statement to return control                    EXITALL                         0014                                to the calling program. The EXIT statement returns control to the                  EXITALL                         0015                                previous calling program, while the EXITALL statement returns                      EXITALL                         0016                                control to the top-level calling program (in the case of multi-                    EXITALL                         0017                                level subprograms).                                                                EXITALL                         0018                                                                                                                   EXITALL                         0019                                A subprogram may execute overlay programs via the <RUN>                            EXITALL                         0020                                statement, in which case the final overlay must execute an EXIT                    EXITALL                         0021                                or EXITALL statement to return to the calling program.                             EXITALL                         0022                                                                                                                   EXITALL                         0023                                The EXITALL statement returns control from any subprogram level                    EXITALL                         0024                                to the top-level calling program (analogous to the way the POPALL                  EXITALL                         0025                                & RETURN statements return program control from a nested                           EXITALL                         0026                                subroutine to the main routine).                                                   EXITALL                         0027                                                                                                                   EXITALL                         0028                              Example:                                                                             EXITALL                         0029                                                                                                                   EXITALL                         0030                                Calling program                                                                    EXITALL                         0031                                ==============================                                                     EXITALL                         0032                                   ENTER "SUBPROG1",DIR="DSK"                                                      EXITALL                         0033                                                                                                                   EXITALL                         0034                                        Subprogram ("SUBPROG1" on "DSK")                                           EXITALL                         0035                                        ================================                                           EXITALL                         0036                                        ENTER "SUBPROG2",DIR="DSK"                                                 EXITALL                         0037                                                                                                                   EXITALL                         0038                                             Subprogram ("SUBPROG2" on "DSK")                                      EXITALL                         0039                                             ================================                                      EXITALL                         0040                                             ENTER "SUBPROG3",DIR="DSK"                                            EXITALL                         0041                                                                                                                   EXITALL                         0042                                                  Subprogram ("SUBPROG3" on "DSK")                                 EXITALL                         0043                                                  ================================                                 EXITALL                         0044                                                  ENTER "SUBPROG4",DIR="DSK"                                       EXITALL                         0045                                                                                                                   EXITALL                         0046                                                       Subprogram ("SUBPROG4" on "DSK")                            EXITALL                         0047                                                       ================================                            EXITALL                         0048                                                       .                                                           EXITALL                         0049                                                       .                                                           EXITALL                         0050                                                       .                                                           EXITALL                         0051                                                       EXITALL                                                     EXITALL                         0052                                                                                                                   EXITALL                         0053                                This example shows the top-level program executing a subprogram,                   EXITALL                         0054                                and the subprogram executing another program, etc. The final                       EXITALL                         0055                                subprogram executes an EXITALL instruction, which returns control                  EXITALL                         0056                                to the top-level calling program.                                                  EXTRACT                         0001                              Syntax:                                                                              EXTRACT                         0002                                                                                                                   EXTRACT                         0003                                EXTRACT (lun, format-statement-label) [KEY=index]                                  EXTRACT                         0004                                        [,EXCP=statement-label]                                                    EXTRACT                         0005                                                                                                                   EXTRACT                         0006                              Discussion:                                                                          EXTRACT                         0007                                                                                                                   EXTRACT                         0008                                The EXTRACT statement performs the same function as the <READ>                     EXTRACT                         0009                                statement but prevents other users from accessing the same record                  EXTRACT                         0010                                at the same time (i.e., it locks the record).                                      EXTRACT                         0011                                                                                                                   EXTRACT                         0012                                Also see <INQUIRE>.                                                                EXTRACT                         0013                                                                                                                   EXTRACT                         0014                                The optional index parameter is used to access a particular                        EXTRACT                         0015                                record in a keyed or indexed sequential file. If an index is not                   EXTRACT                         0016                                specified, the file is read in key-sequential order.                               EXTRACT                         0017                                                                                                                   EXTRACT                         0018                                When the index parameter is used with keyed files, the index                       EXTRACT                         0019                                (key) can be any valid string expression. If the key index is                      EXTRACT                         0020                                shorter that the file key size, it is padded with trailing blanks                  EXTRACT                         0021                                prior to the key search. If it is longer than the key size,                        EXTRACT                         0022                                excess trailing characters are truncated prior to the key search.                  EXTRACT                         0023                                If the key index is not found in the key list, the file pointer                    EXTRACT                         0024                                is positioned at the next key and an exception 32 is encountered.                  EXTRACT                         0025                                                                                                                   EXTRACT                         0026                                When the index parameter is used with indexed sequential files,                    EXTRACT                         0027                                the key index is equivalent to the record number to be extracted.                  EXTRACT                         0028                                The index may be any valid numeric expression (truncated to an                     EXTRACT                         0029                                integer before the record is extracted). A key index with a                        EXTRACT                         0030                                negative or zero value, or one with a value beyond the last                        EXTRACT                         0031                                record in the file, will produce an exception.                                     EXTRACT                         0032                                                                                                                   EXTRACT                         0033                                Unlike the READ statement, EXTRACT does not automatically advance                  EXTRACT                         0034                                the file pointer to the next record in the file. This allows a                     EXTRACT                         0035                                program to extract a record, modify the data, and write is back                    EXTRACT                         0036                                to the file without specifying a key index value.                                  EXTRACT                         0037                                                                                                                   EXTRACT                         0038                                A record that is locked by EXTRACT is released when the                            EXTRACT                         0039                                initiating user accesses the same logical unit number again,                       EXTRACT                         0040                                usually with a READ, EXTRACT, <DELETE>, <WRITE>, or <CLOSE>                        EXTRACT                         0041                                statement.                                                                         EXTRACT                         0042                                                                                                                   EXTRACT                         0043                                EXTRACTIMAGE performs an extract operation for an image record.                    EXTRACT                         0044                                In image records, numeric data is packed two digits per byte,                      EXTRACT                         0045                                with no decimal point. Image records are created with the                          EXTRACT                         0046                                WRITEIMAGE statement and must be retrieved with either the                         EXTRACT                         0047                                READIMAGE or EXTRACTIMAGE statement.                                               EXTRACT                         0048                                                                                                                   EXTRACT                         0049                                For more information on image records, see the                                     EXTRACT                         0050                                <Overview of the Comet File System,#HELPMT2>.                                      EXTRACT                         0051                                                                                                                   EXTRACT                         0052                                The syntax is:                                                                     EXTRACT                         0053                                                                                                                   EXTRACT                         0054                                   EXTRACTIMAGE (lun, format-statement-label) [KEY=index]                          EXTRACT                         0055                                                [,EXCP=statement-label]                                            EXTRACT                         0056                                                                                                                   EXTRACT                         0057                              Example:                                                                             EXTRACT                         0058                                                                                                                   EXTRACT                         0059                                1000 FORMAT CUSTNUM$;NAME$;ADDRESS1$;ADDRESS2$;...                                 EXTRACT                         0060                                .                                                                                  EXTRACT                         0061                                OPEN (1) "CUSTFILE"                                                                EXTRACT                         0062                                .                                                                                  EXTRACT                         0063                                INPUT (0) CUSTNUM$                                                                 EXTRACT                         0064                                EXTRACT (1,1000) KEY=CUSTNUM$,EXCP=9999                                            EXTRACT                         0065                                                                                                                   EXTRACT                         0066                                This example shows how to use EXTRACT to read and lock a single                    EXTRACT                         0067                                data record. While this record is extracted, other users will not                  EXTRACT                         0068                                be able to access it -- any attempt to access this record from                     EXTRACT                         0069                                another program will result in an exception 33 for the other                       EXTRACT                         0070                                program.                                                                           Exception Handling              0001                              Exception Handling                                                                   Exception Handling              0002                              ==================                                                                   Exception Handling              0003                                                                                                                   Exception Handling              0004                                All input/output statements in MTB allow for exception handling.                   Exception Handling              0005                                The <EXCP=>statement-label parameter is used to specify an                         Exception Handling              0006                                "exception path" to follow if an exception occurs during program                   Exception Handling              0007                                execution. For example:                                                            Exception Handling              0008                                                                                                                   Exception Handling              0009                                   <READ> (1,1000) <KEY=>CUSTNUM$, <EXCP=>9999                                     Exception Handling              0010                                                                                                                   Exception Handling              0011                                In this example, a statement-label of 9999 is specified as the                     Exception Handling              0012                                exception path for the READ statement. This means that if this                     Exception Handling              0013                                statement encounters an exception when it is executed, the                         Exception Handling              0014                                program will branch to statement 9999, instead of abnormally                       Exception Handling              0015                                ending.                                                                            Exception Handling              0016                                                                                                                   Exception Handling              0017                                There are two exception branching parameters:                                      Exception Handling              0018                                                                                                                   Exception Handling              0019                                <EXCP=>statement-label      branches to statement-label                            Exception Handling              0020                                                                                                                   Exception Handling              0021                                <EXCPSUB=>statement-label   branches to subroutine                                 Exception Handling              0022                                                                                                                   Exception Handling              0023                                In any exception routine, the program may include statements to                    Exception Handling              0024                                inquire into the nature of the exception. This is done with the                    Exception Handling              0025                                system variable named <EXCP,#HELPMT3>, which contains the number                   Exception Handling              0026                                of the most recently encountered Comet exception.                                  Exception Handling              0027                                                                                                                   Exception Handling              0028                                See <Comet exception messages,#HELPMT6>.                                           Exception Handling              0029                                                                                                                   Exception Handling              0030                                Following the example from above, an exception routine could look                  Exception Handling              0031                                like this:                                                                         Exception Handling              0032                                                                                                                   Exception Handling              0033                                9999    IF EXCP=32 THEN PRINT (0) "KEY NOT FOUND" & GOTO 100                       Exception Handling              0034                                        IF EXCP=33 THEN PRINT (0) "RECORD EXTRACTED" & GOTO 100                    Exception Handling              0035                                                                                                                   Exception Handling              0036                                This routine, starting with the label 9999, checks the system                      Exception Handling              0037                                variable EXCP for two of the most common values that might be                      Exception Handling              0038                                encountered during a READ:                                                         Exception Handling              0039                                                                                                                   Exception Handling              0040                                EXCP value   Meaning                                                               Exception Handling              0041                                =================================================================                  Exception Handling              0042                                32           The specified key was not found in the key list                       Exception Handling              0043                                33           The specified key was extracted by another user                       Exception Handling              0044                                                                                                                   Exception Handling              0045                                In an exception routine, there are various ways to deal with                       Exception Handling              0046                                runtime exceptions. One way is to simply branch back to a logical                  Exception Handling              0047                                starting place in the program and start over. Another is to retry                  Exception Handling              0048                                the action that caused the exception. This is done with the AGAIN                  Exception Handling              0049                                statement.                                                                         Exception Handling              0050                                                                                                                   Exception Handling              0051                                Another course is to instruct the program to come to an abnormal                   Exception Handling              0052                                end, in the case where all possible exceptions have been tested                    Exception Handling              0053                                for and handled.                                                                   Exception Handling              0054                                                                                                                   Exception Handling              0055                                For example:                                                                       Exception Handling              0056                                                                                                                   Exception Handling              0057                                9999    IF EXCP=33 THEN PRINT (0) "RECORD EXTRACTED" & AGAIN                       Exception Handling              0058                                        IF EXCP=32 THEN PRINT (0) "KEY NOT FOUND" & GOTO 100                       Exception Handling              0059                                        <ERROR>                                                                    Exception Handling              0060                                                                                                                   Exception Handling              0061                                In this exception routine, if the exception is 33, the program                     Exception Handling              0062                                will display a message that the record is extracted and try the                    Exception Handling              0063                                I/O statement again (as specified by the AGAIN statement). Note:                   Exception Handling              0064                                This method should be used with care, as it could result in and                    Exception Handling              0065                                endless loop of trying the I/O statement, testing for exception                    Exception Handling              0066                                33, trying the I/O statement, etc.                                                 Exception Handling              0067                                                                                                                   Exception Handling              0068                                In the above routine, if exceptions 32 and 33 are not the cause,                   Exception Handling              0069                                the program is instructed to take an abnormal end (the ERROR                       Exception Handling              0070                                statement does this). When ERROR is encountered, the QENDITOR                      Exception Handling              0071                                program will be executed and the Comet exception will be                           Exception Handling              0072                                displayed on the controlling terminal.                                             Exception Handling              0073                                                                                                                   Exception Handling              0074                                Other exception handling statements include <ERRORTO> and                          Exception Handling              0075                                <ERRRORSUB>, statements that set default exception paths.                          FILE                            0001                              Syntax:                                                                              FILE                            0002                                                                                                                   FILE                            0003                                <FILE|FILE BUF> (lun) BUF=buffer-size                                              FILE                            0004                                <FILE|FILE DLM> (lun) DLM=delimiter-string                                         FILE                            0005                                <FILE|FILE POS> (lun) POS=file-position                                            FILE                            0006                                <FILE|FILE CTL> (lun) CTL=control-parameter                                        FILE                            0007                                <FILE|FILE FORWARD> (lun) FORWARD                                                  FILE                            0008                                <FILE|FILE REVERSE> (lun) REVERSE                                                  FILE                            0009                                                                                                                   FILE                            0010                              Discussion:                                                                          FILE                            0011                                                                                                                   FILE                            0012                                The FILE statement is used for several purposes, including:                        FILE                            0013                                                                                                                   FILE                            0014                                *  <setting the buffer size|FILE BUF> for an asynchronous                          FILE                            0015                                   device, or <setting the delimiter string|FILE DLM>                              FILE                            0016                                                                                                                   FILE                            0017                                *  <moving the file pointer|FILE POS> in a disk file                               FILE                            0018                                                                                                                   FILE                            0019                                *  changing the direction of the file pointer to                                   FILE                            0020                                   <forward|FILE FORWARD> or <reverse|FILE REVERSE>                                FILE                            0021                                                                                                                   FILE                            0022                                *  setting various <control functions|FILE CTL>                                    FILE BUF                        0001                              Syntax:                                                                              FILE BUF                        0002                                                                                                                   FILE BUF                        0003                                FILE (lun) BUF=buffer-size                                                         FILE BUF                        0004                                                                                                                   FILE BUF                        0005                              Discussion:                                                                          FILE BUF                        0006                                                                                                                   FILE BUF                        0007                                This statement is used to set the mode for the asynchronous                        FILE BUF                        0008                                device such that a read is satiated after the specified number of                  FILE BUF                        0009                                characters is received. The device remains in this mode until the                  FILE BUF                        0010                                mode is changed or the system is reset. The buffer-size is an                      FILE BUF                        0011                                integer in the range of 1 to 1,024.                                                FILE CTL                        0001                              Syntax:                                                                              FILE CTL                        0002                                                                                                                   FILE CTL                        0003                                FILE (lun) CTL=control-parameter                                                   FILE CTL                        0004                                                                                                                   FILE CTL                        0005                              Discussion:                                                                          FILE CTL                        0006                                                                                                                   FILE CTL                        0007                                This statement serves several purposes, as follows:                                FILE CTL                        0008                                                                                                                   FILE CTL                        0009                                1. FILE (lun) CTL="@00@"                                                           FILE CTL                        0010                                                                                                                   FILE CTL                        0011                                   Temporarily suspends the interrupt-driven printer driver so                     FILE CTL                        0012                                   that programs such as BARRES may work correctly.                                FILE CTL                        0013                                                                                                                   FILE CTL                        0014                                2. FILE (lun) CTL="@01@"                                                           FILE CTL                        0015                                                                                                                   FILE CTL                        0016                                   Reactivates the interrupt-driven printer driver after it has                    FILE CTL                        0017                                   been suspended.                                                                 FILE CTL                        0018                                                                                                                   FILE CTL                        0019                                3. FILE (lun) CTL=FLUSH                                                            FILE CTL                        0020                                                                                                                   FILE CTL                        0021                                   First use designates that a file is a "flushable file," so                      FILE CTL                        0022                                   that records will not be written to disk until the FLUSH                        FILE CTL                        0023                                   control is issued a second time, the system buffers are full,                   FILE CTL                        0024                                   or the file is closed.                                                          FILE CTL                        0025                                                                                                                   FILE CTL                        0026                                   Subsequent execution of this statement forces all records that                  FILE CTL                        0027                                   were not previously written to the disk to be written. The                      FILE CTL                        0028                                   flush factor works in conjunction with DOS. Under normal DOS                    FILE CTL                        0029                                   operation, disk writes are stacked in buffers and physically                    FILE CTL                        0030                                   written to disk when the number of buffers is exhausted. To                     FILE CTL                        0031                                   preserve the integrity of a file, Comet "fools" DOS and always                  FILE CTL                        0032                                   writes through to the disk. Depending on the number of buffers                  FILE CTL                        0033                                   you have from Comet (in the CONFIG.SYS) file, using the FLUSH                   FILE CTL                        0034                                   file control lets you stack up WRITEs to the disk until either                  FILE CTL                        0035                                   the number of buffers is exhausted (and DOS forces the write)                   FILE CTL                        0036                                   or a FLUSH control is issued by the program.                                    FILE CTL                        0037                                                                                                                   FILE CTL                        0038                                   Note: This method of using a file can be fast because it can                    FILE CTL                        0039                                   reduce the number of file accesses for temporary files. It is                   FILE CTL                        0040                                   not recommended for use with permanent files, or files that                     FILE CTL                        0041                                   can be damaged if a power failure causes the buffers not to be                  FILE CTL                        0042                                   written. Keyed files could be particularly susceptible because                  FILE CTL                        0043                                   integral parts of the key structure could be in the buffers,                    FILE CTL                        0044                                   and not on the disk. Therefore, use with discretion.                            FILE CTL                        0045                                                                                                                   FILE CTL                        0046                                   Note that this optional way of handling files is the way that                   FILE CTL                        0047                                   all files are handled under UNIX and many mainframe computers.                  FILE CTL                        0048                                   Using this method of writing to a memory buffer, systems must                   FILE CTL                        0049                                   always be gracefully shut down and restarted, and if they                       FILE CTL                        0050                                   crash, must always be restored from a backup.                                   FILE DLM                        0001                              Syntax:                                                                              FILE DLM                        0002                                                                                                                   FILE DLM                        0003                                FILE (lun) DLM=delimiter string                                                    FILE DLM                        0004                                                                                                                   FILE DLM                        0005                              Discussion:                                                                          FILE DLM                        0006                                                                                                                   FILE DLM                        0007                                This statement is used to set the mode for the asynchronous                        FILE DLM                        0008                                device such that the read is satisfied when the specified                          FILE DLM                        0009                                character is received, where DLM string is a one-byte character.                   FILE DLM                        0010                                Note that the default mode for asynchronous devices is DLM="@0D@"                  FILE DLM                        0011                                (i.e., a carriage return character).                                               FILE FORWARD                    0001                              Syntax:                                                                              FILE FORWARD                    0002                                                                                                                   FILE FORWARD                    0003                                FILE (lun) FORWARD                                                                 FILE FORWARD                    0004                                                                                                                   FILE FORWARD                    0005                              Discussion:                                                                          FILE FORWARD                    0006                                                                                                                   FILE FORWARD                    0007                                The FILE (lun) FORWARD statement sets the read pointer in the                      FILE FORWARD                    0008                                forward direction. Subsequent sequential reads will return                         FILE FORWARD                    0009                                records in ascending ASCII order of the keys.                                      FILE FORWARD                    0010                                                                                                                   FILE FORWARD                    0011                                The logical unit number (lun) parameter refers to a currently                      FILE FORWARD                    0012                                open keyed file. As the program performs sequential reads (i.e.,                   FILE FORWARD                    0013                                reads without a specific key), the records will be returned in                     FILE FORWARD                    0014                                ascending ASCII order of the keys in the key tree.                                 FILE FORWARD                    0015                                                                                                                   FILE FORWARD                    0016                                Note:  The FORWARD direction is the default for files when they                    FILE FORWARD                    0017                                are opened.                                                                        FILE FORWARD                    0018                                                                                                                   FILE FORWARD                    0019                                See <FILE (lun) REVERSE|FILE REVERSE>.                                             FILE FORWARD                    0020                                                                                                                   FILE FORWARD                    0021                              Example:                                                                             FILE FORWARD                    0022                                                                                                                   FILE FORWARD                    0023                                OPEN (1) "CUSTHIST",DIR="DSK"                                                      FILE FORWARD                    0024                                FILE (1) FORWARD                                                                   FILE FORWARD                    0025                                                                                                                   FILE FORWARD                    0026                                This example opens a file named CUSTHIST as logical unit number                    FILE FORWARD                    0027                                1, and specifies that sequential read operations proceed in                        FILE FORWARD                    0028                                ascending ASCII order. Because the read pointer direction is                       FILE FORWARD                    0029                                forward by default when as file is open, the second line in this                   FILE FORWARD                    0030                                example is redundant.                                                              FILE POS                        0001                              Syntax:                                                                              FILE POS                        0002                                                                                                                   FILE POS                        0003                                FILE (lun) POS=file-position                                                       FILE POS                        0004                                                                                                                   FILE POS                        0005                              Discussion:                                                                          FILE POS                        0006                                                                                                                   FILE POS                        0007                                This statement is used to move the file pointer to the beginning                   FILE POS                        0008                                or end of a file.                                                                  FILE POS                        0009                                                                                                                   FILE POS                        0010                                   POS=BOF   moves the pointer to the beginning of the file                        FILE POS                        0011                                                                                                                   FILE POS                        0012                                   POS=EOF   moves the pointer to the end of the file                              FILE REVERSE                    0001                              Syntax:                                                                              FILE REVERSE                    0002                                                                                                                   FILE REVERSE                    0003                                FILE (lun) REVERSE                                                                 FILE REVERSE                    0004                                                                                                                   FILE REVERSE                    0005                              Discussion:                                                                          FILE REVERSE                    0006                                                                                                                   FILE REVERSE                    0007                                The FILE (lun) REVERSE statement sets the read pointer in the                      FILE REVERSE                    0008                                reverse direction. Subsequent sequential reads will return                         FILE REVERSE                    0009                                records in descending ASCII order of the keys.                                     FILE REVERSE                    0010                                                                                                                   FILE REVERSE                    0011                                The logical unit number (lun) parameter refers to a currently                      FILE REVERSE                    0012                                open keyed file. As the program performs sequential reads (i.e.,                   FILE REVERSE                    0013                                reads without a specific key), the records will be returned in                     FILE REVERSE                    0014                                descending ASCII order of the keys in the key tree.                                FILE REVERSE                    0015                                                                                                                   FILE REVERSE                    0016                                Note:  The FORWARD direction is the default for files when they                    FILE REVERSE                    0017                                are opened.                                                                        FILE REVERSE                    0018                                                                                                                   FILE REVERSE                    0019                                See <FILE (lun) FORWARD|FILE FORWARD>.                                             FILE REVERSE                    0020                                                                                                                   FILE REVERSE                    0021                              Example:                                                                             FILE REVERSE                    0022                                                                                                                   FILE REVERSE                    0023                                OPEN (1) "CUSTHIST",DIR="DSK"                                                      FILE REVERSE                    0024                                FILE (1) REVERSE                                                                   FILE REVERSE                    0025                                                                                                                   FILE REVERSE                    0026                                This example opens a file named CUSTHIST as logical unit number                    FILE REVERSE                    0027                                1, and specifies that sequential read operations proceed in                        FILE REVERSE                    0028                                descending ASCII order.                                                            FIRST                           0001                              Syntax:                                                                              FIRST                           0002                                                                                                                   FIRST                           0003                                FIRST(lun [,EXCP=statement-label])                                                 FIRST                           0004                                                                                                                   FIRST                           0005                              Discussion:                                                                          FIRST                           0006                                                                                                                   FIRST                           0007                                The FIRST function returns the value of the first key in the file                  FIRST                           0008                                that is open on the specified logical unit number (<lun>). The                     FIRST                           0009                                first key is the lowest <ASCII> valued key contained in the file.                  FIRST                           0010                                                                                                                   FIRST                           0011                                Notes:                                                                             FIRST                           0012                                                                                                                   FIRST                           0013                                1. The FIRST function is valid only for keyed files.                               FIRST                           0014                                                                                                                   FIRST                           0015                                2. If the FIRST function is attempted on an empty keyed file, an                   FIRST                           0016                                   exception 2 (END OF FILE) will be reported.                                     FIRST                           0017                                                                                                                   FIRST                           0018                                3. The FIRST function does not move the record pointer.                            FIRST                           0019                                                                                                                   FIRST                           0020                                Application note: Some applications employ the FIRST function as                   FIRST                           0021                                a way of moving the record pointer to the beginning of the file                    FIRST                           0022                                (i.e., use the FIRST function to determine the first key and then                  FIRST                           0023                                <READ> using that value). A more efficient way to accomplish this                  FIRST                           0024                                result is to use the <FILE> statement to position the record                       FIRST                           0025                                pointer to the beginning of the file.                                              FIRST                           0026                                                                                                                   FIRST                           0027                              Example:                                                                             FIRST                           0028                                                                                                                   FIRST                           0029                                OPEN (1) "SALES"                                                                   FIRST                           0030                                FIRSTKEY$ = FIRST(1,EXCP=9999)                                                     FIRST                           0031                                                                                                                   FIRST                           0032                                In the above example, the FIRST function is used to determine the                  FIRST                           0033                                value of the first key in the SALES file. If an exception occurs                   FIRST                           0034                                when this statement is executed, program control will transfer to                  FIRST                           0035                                exception-statement-label 9999.                                                    FOR                             0001                              Syntax:                                                                              FOR                             0002                                                                                                                   FOR                             0003                                FOR control-variable = start-count TO stop-count [STEP increment]                  FOR                             0004                                .                                                                                  FOR                             0005                                <NEXT> control-variable                                                            FOR                             0006                                                                                                                   FOR                             0007                              Discussion:                                                                          FOR                             0008                                                                                                                   FOR                             0009                                The FOR statement starts a repetitive series of program                            FOR                             0010                                statements (i.e., a loop). The statements following a FOR                          FOR                             0011                                statement up to the associated <NEXT> statement form the loop.                     FOR                             0012                                                                                                                   FOR                             0013                                The control-variable parameter is a previously-defined numeric                     FOR                             0014                                variable with sufficient length and precision to store the values                  FOR                             0015                                specified by the start-count, stop-count, and increment                            FOR                             0016                                parameters.                                                                        FOR                             0017                                                                                                                   FOR                             0018                                The start-count parameter is the initial value assigned to the                     FOR                             0019                                control-variable. It may be a numeric constant or numeric                          FOR                             0020                                variable. In either case, it must have a non-negative value.                       FOR                             0021                                                                                                                   FOR                             0022                                The stop-count parameter is the maximum value assigned to the                      FOR                             0023                                control-variable. Stop-count may be a numeric constant or numeric                  FOR                             0024                                variable with a positive value. When the maximum value has been                    FOR                             0025                                reached, the statements inside the loop will be executed for a                     FOR                             0026                                final time and program flow will continue at the statement                         FOR                             0027                                immediately following the NEXT statement. (The control-variable                    FOR                             0028                                will retain the maximum value assigned.)                                           FOR                             0029                                                                                                                   FOR                             0030                                During the looping process, the value of the control-variable                      FOR                             0031                                will be incremented according to the increment parameter. If not                   FOR                             0032                                specified, the increment will be 1. The increment may be a                         FOR                             0033                                numeric constant or numeric variable. In either case, it must                      FOR                             0034                                always have a positive value. It follows, then, that the value of                  FOR                             0035                                the start-count parameter must be less than the value of the                       FOR                             0036                                stop-count.                                                                        FOR                             0037                                                                                                                   FOR                             0038                                FOR/NEXT loops may be nested to any level.                                         FOR                             0039                                                                                                                   FOR                             0040                              Example 1:                                                                           FOR                             0041                                                                                                                   FOR                             0042                                FOR VALUE = 1 TO 250        ! Start loop from 1 to 250                             FOR                             0043                                SQUARE = VALUE * VALUE      ! Compute square                                       FOR                             0044                                PRINT (0) VALUE;SQUARE      ! Print value and square                               FOR                             0045                                NEXT VALUE                  ! Continue loop                                        FOR                             0046                                                                                                                   FOR                             0047                              Example 2:                                                                           FOR                             0048                                                                                                                   FOR                             0049                                FOR LINE = 1 TO 60          ! Loop from 1 to 60                                    FOR                             0050                                READ (1,DATA) EXCP=9999     ! Read the next data record                            FOR                             0051                                PRINT (2,INFO)              ! Print a line on the printer                          FOR                             0052                                NEXT LINE                   ! Continue loop                                        FOR                             0053                                                                                                                   FOR                             0054                              Example 3:                                                                           FOR                             0055                                                                                                                   FOR                             0056                                FOR I = J TO K STEP M       ! Loop using variable values                           FOR                             0057                                PRINT (0) "Value is: ";I    ! Print the value                                      FOR                             0058                                NEXT I                      ! Continue loop                                        FOR                             0059                                                                                                                   FOR                             0060                              Example 4:                                                                           FOR                             0061                                                                                                                   FOR                             0062                                FOR ROW = 1 TO 50           ! Start outer loop (count 1 to 50)                     FOR                             0063                                FOR COLUMN = 1 TO 200       ! Start inner loop (count 1 to 200)                    FOR                             0064                                SUM=SUM+DATA(COLUMN,ROW)    ! Add up array elements                                FOR                             0065                                NEXT COLUMN                 ! Continue inner loop                                  FOR                             0066                                NEXT ROW                    ! Continue outer loop                                  FPT                             0001                              Syntax:                                                                              FPT                             0002                                                                                                                   FPT                             0003                                FPT(numeric-argument)                                                              FPT                             0004                                                                                                                   FPT                             0005                              Discussion:                                                                          FPT                             0006                                                                                                                   FPT                             0007                                The FPT function returns the fractional portion of a numeric-                      FPT                             0008                                argument. The value returned by the FPT function is always a                       FPT                             0009                                decimal value and always carries the same sign as the numeric-                     FPT                             0010                                argument.                                                                          FPT                             0011                                                                                                                   FPT                             0012                                The numeric-argument may be a numeric constant, a single-element                   FPT                             0013                                numeric variable, a numeric array element, a numeric expression,                   FPT                             0014                                or a numeric function.                                                             FPT                             0015                                                                                                                   FPT                             0016                                The intermediate result of the FPT function is stored in a                         FPT                             0017                                numeric accumulator with a length and precision of 16.8. If this                   FPT                             0018                                intermediate result is then moved to a receiving numeric                           FPT                             0019                                variable, its precision is automatically adjusted to the defined                   FPT                             0020                                precision of that variable.                                                        FPT                             0021                                                                                                                   FPT                             0022                                Also see <INT>.                                                                    FPT                             0023                                                                                                                   FPT                             0024                              Example:                                                                             FPT                             0025                                                                                                                   FPT                             0026                                A = FPT(B)                                                                         FPT                             0027                                                                                                                   FPT                             0028                                In the above example, the fractional portion of numeric variable                   FPT                             0029                                B is moved to numeric variable A. For example, if B equals 27.43,                  FPT                             0030                                then A equals .43.                                                                 FSTAT                           0001                              Syntax:                                                                              FSTAT                           0002                                                                                                                   FSTAT                           0003                                FSTAT(filename[,DIR=directory][,EXCP=statement-label])                             FSTAT                           0004                                                                                                                   FSTAT                           0005                              Discussion:                                                                          FSTAT                           0006                                                                                                                   FSTAT                           0007                                The FSTAT function returns file status information.                                FSTAT                           0008                                                                                                                   FSTAT                           0009                                The filename may be a string constant, a single-element string                     FSTAT                           0010                                variable, a string array element, a string expression, or a                        FSTAT                           0011                                string function.                                                                   FSTAT                           0012                                                                                                                   FSTAT                           0013                              Return values:                                                                       FSTAT                           0014                                                                                                                   FSTAT                           0015                              Length    Position  Description/Values                                               FSTAT                           0016                              ===================================================================                  FSTAT                           0017                              1         1         File type                                                        FSTAT                           0018                                                  K = keyed file                                                   FSTAT                           0019                                                  S = sequential file                                              FSTAT                           0020                                                  T = text file                                                    FSTAT                           0021                                                  O = MTB object program                                           FSTAT                           0022                                                  Q = QICBASIC object program                                      FSTAT                           0023                              2         1         Locked status                                                    FSTAT                           0024                                                  "P" = locked                                                     FSTAT                           0025                                                  "" or "@00@" = unlocked                                          FSTAT                           0026                              3         3         Directory name                                                   FSTAT                           0027                              6         3         Open count (decimal)                                             FSTAT                           0028                              9         3         Extract count (decimal)                                          FSTAT                           0029                              12        3         Record size (# of bytes, decimal)                                FSTAT                           0030                              15        4         Size of data file (# of bytes, hex)                              FSTAT                           0031                              19        6         Create date (MMDDYY)                                             FSTAT                           0032                              25        6         Update date (MMDDYY)                                             FSTAT                           0033                              31        2         Key length                                                       FSTAT                           0034                                                  (# of bytes, decimal, key files only)                            FSTAT                           0035                              33        2         Unused                                                           FSTAT                           0036                              35        11        Next file name in directory                                      FSTAT                           0037                                                  bytes 1-8 = file name                                            FSTAT                           0038                                                  bytes 9-11 = reserved                                            FSTAT                           0039                              46        4         Record size (# of bytes, decimal, 4 digits)                      FSTAT                           0040                              50        79        Unused                                                           FSTAT                           0041                              129       2         Time of last update (seconds, 2 digits)                          FSTAT                           0042                              131       4         Time of last update HHMM                                         FSTAT                           0043                              135       4         File length of I00 file (# of bytes, hex)                        FSTAT                           0044                              139       8         Library file name (if object file is bound)                      FSTAT                           0045                              147       4         Position of object in library file (if object                    FSTAT                           0046                                                  file is bound)                                                   FSTAT                           0047                                                                                                                   FSTAT                           0048                              Example:                                                                             FSTAT                           0049                                                                                                                   FSTAT                           0050                                LENGTH 150 & LOCAL VALUE$                                                          FSTAT                           0051                                .                                                                                  FSTAT                           0052                                VALUE$ = FSTAT("C1A",EXCP=9999)                                                    FSTAT                           0053                                                                                                                   FSTAT                           0054                                This example shows how the FSTAT function can be used to obtain                    FSTAT                           0055                                file status information for a file named "C1A".                                    GOSUB                           0001                              Syntax:                                                                              GOSUB                           0002                                                                                                                   GOSUB                           0003                                GOSUB statement-label                                                              GOSUB                           0004                                                                                                                   GOSUB                           0005                              Discussion:                                                                          GOSUB                           0006                                                                                                                   GOSUB                           0007                                The GOSUB statement directs program control to the specified                       GOSUB                           0008                                statement-label and places the next executable address in a                        GOSUB                           0009                                subroutine stack.                                                                  GOSUB                           0010                                                                                                                   GOSUB                           0011                                Subsequent execution of a <RETURN> statement will direct program                   GOSUB                           0012                                control to the saved address (the next statement following the                     GOSUB                           0013                                original GOSUB statement).                                                         GOSUB                           0014                                                                                                                   GOSUB                           0015                                The statement-label defines the beginning of a "subroutine," even                  GOSUB                           0016                                though the program lines are contained in the main MTB program                     GOSUB                           0017                                itself. Subroutines themselves may invoke other subroutines --                     GOSUB                           0018                                these are called "nested subroutines."  Subroutines may be nested                  GOSUB                           0019                                up to 16 levels. Attempting to nest beyond this depth will result                  GOSUB                           0020                                in a "GOSUB STACK OVERFLOW" exception.                                             GOSUB                           0021                                                                                                                   GOSUB                           0022                                Also see <POP> and <POPALL>.                                                       GOSUB                           0023                                                                                                                   GOSUB                           0024                              Example 1:                                                                           GOSUB                           0025                                                                                                                   GOSUB                           0026                                OPEN (1) "C1A" EXCP=9000                                                           GOSUB                           0027                                READ (1,1000) EXCP=8000                                                            GOSUB                           0028                                PRINT (0) "PROCESSING CUSTOMER:";CUSTNO$                                           GOSUB                           0029                                GOSUB 1000                                                                         GOSUB                           0030                                PRINT (0) "COMPLETED CUSTOMER:";CUSTNO$                                            GOSUB                           0031                                .                                                                                  GOSUB                           0032                                STOP                                                                               GOSUB                           0033                                                                                                                   GOSUB                           0034                                1000 CRAVAIL = CRLIMIT - ARTOTAL                                                   GOSUB                           0035                                .                                                                                  GOSUB                           0036                                RETURN                                                                             GOSUB                           0037                                                                                                                   GOSUB                           0038                                In this example, the main section of the program opens a data                      GOSUB                           0039                                file called "C1A", then reads a record from the file (in                           GOSUB                           0040                                sequential order). Next, the program displays a message on the                     GOSUB                           0041                                video terminal (logical unit 0) and branches to a subroutine at                    GOSUB                           0042                                statement-label 1000.                                                              GOSUB                           0043                                                                                                                   GOSUB                           0044                                Processing continues in the subroutine until the program                           GOSUB                           0045                                encounters the RETURN statement. At this point, control is                         GOSUB                           0046                                transferred back to the main section of the program (to the                        GOSUB                           0047                                statement immediately after the GOSUB 1000 statement).                             GOSUB                           0048                                                                                                                   GOSUB                           0049                                The STOP statement is included in the main section of the program                  GOSUB                           0050                                to prevent program flow from entering the subroutine without                       GOSUB                           0051                                using the GOSUB statement.                                                         GOSUB                           0052                                                                                                                   GOSUB                           0053                              Example 2:                                                                           GOSUB                           0054                                                                                                                   GOSUB                           0055                                GOSUB ONE                                                                          GOSUB                           0056                                .                                                                                  GOSUB                           0057                                CLOSE                                                                              GOSUB                           0058                                RUN "QMONITOR"                                                                     GOSUB                           0059                                ----------------------------------------------------                               GOSUB                           0060                                ONE: ! Subroutine 1                                                                GOSUB                           0061                                .                                                                                  GOSUB                           0062                                GOSUB TWO                                                                          GOSUB                           0063                                .                                                                                  GOSUB                           0064                                RETURN                                                                             GOSUB                           0065                                ----------------------------------------------------                               GOSUB                           0066                                TWO: ! Subroutine 2                                                                GOSUB                           0067                                .                                                                                  GOSUB                           0068                                GOSUB THREE                                                                        GOSUB                           0069                                .                                                                                  GOSUB                           0070                                RETURN                                                                             GOSUB                           0071                                ----------------------------------------------------                               GOSUB                           0072                                THREE: ! Subroutine 3                                                              GOSUB                           0073                                .                                                                                  GOSUB                           0074                                RETURN                                                                             GOSUB                           0075                                                                                                                   GOSUB                           0076                                This example shows the skeleton construction of nested                             GOSUB                           0077                                subroutines. The main section of the above program includes a                      GOSUB                           0078                                statement to direct control to a subroutine labelled ONE.                          GOSUB                           0079                                                                                                                   GOSUB                           0080                                In subroutine ONE, there is a call to a nested subroutine called                   GOSUB                           0081                                TWO. From this subroutine, there is a further call to a nested                     GOSUB                           0082                                subroutine called THREE.                                                           GOSUB                           0083                                                                                                                   GOSUB                           0084                                Notice that all of the subroutines end with a RETURN statement,                    GOSUB                           0085                                which directs control to the statement following the most recent                   GOSUB                           0086                                GOSUB call.                                                                        GOTO                            0001                              Syntax:                                                                              GOTO                            0002                                                                                                                   GOTO                            0003                                GOTO statement-label                                                               GOTO                            0004                                GO TO statement-label                                                              GOTO                            0005                                GO statement-label                                                                 GOTO                            0006                                                                                                                   GOTO                            0007                              Discussion:                                                                          GOTO                            0008                                                                                                                   GOTO                            0009                                The GOTO statement transfers program control to the specified                      GOTO                            0010                                statement-label.                                                                   GOTO                            0011                                                                                                                   GOTO                            0012                                The MTB compiler recognizes three variations of this statement,                    GOTO                            0013                                including GOTO (two words, no space), GO TO (two words, one                        GOTO                            0014                                space), or GO (one word only).                                                     GOTO                            0015                                                                                                                   GOTO                            0016                                Note: With the GOTO statement, there is no built-in provision for                  GOTO                            0017                                returning to the point where the GOTO statement was issued (this                   GOTO                            0018                                provision exists with the <GOSUB> statement, as well as other                      GOTO                            0019                                subroutine generating statements).                                                 GOTO                            0020                                                                                                                   GOTO                            0021                                Also see <ON/GOTO>.                                                                GOTO                            0022                                                                                                                   GOTO                            0023                              Example 1:                                                                           GOTO                            0024                                                                                                                   GOTO                            0025                                TOP: READ (1,1000) EXCP=9000                                                       GOTO                            0026                                .                                                                                  GOTO                            0027                                .                                                                                  GOTO                            0028                                .                                                                                  GOTO                            0029                                GOTO TOP                                                                           GOTO                            0030                                                                                                                   GOTO                            0031                                In the above example, the GOTO statement is used to create a                       GOTO                            0032                                program loop. The statement labelled TOP represents the start of                   GOTO                            0033                                the loop. Other program statements are presumed to follow. At the                  GOTO                            0034                                end of these statements, the GOTO statement transfers program                      GOTO                            0035                                control back to TOP, thus creating a loop.                                         GOTO                            0036                                                                                                                   GOTO                            0037                              Example 2:                                                                           GOTO                            0038                                                                                                                   GOTO                            0039                                IF ANSWER$ = "N" THEN GOTO 5000                                                    GOTO                            0040                                                                                                                   GOTO                            0041                                In this example, the GOTO statement is used to transfer program                    GOTO                            0042                                control to statement label 5000 only if the string variable                        GOTO                            0043                                ANSWER$ is equal to "N" (a logical condition being tested by the                   GOTO                            0044                                IF/THEN statement).                                                                HEXASC                          0001                              Syntax:                                                                              HEXASC                          0002                                                                                                                   HEXASC                          0003                                HEXASC(string-argument)                                                            HEXASC                          0004                                                                                                                   HEXASC                          0005                              Discussion:                                                                          HEXASC                          0006                                                                                                                   HEXASC                          0007                                The HEXASC function converts an <ASCII> hex string to its ASCII                    HEXASC                          0008                                hex equivalent, character for character.                                           HEXASC                          0009                                                                                                                   HEXASC                          0010                                The string-argument represents the string to be converted. The                     HEXASC                          0011                                string-argument may be a string constant, a single-element string                  HEXASC                          0012                                variable, a string array element, a string expression, or a                        HEXASC                          0013                                string function.                                                                   HEXASC                          0014                                                                                                                   HEXASC                          0015                                The result of the HEXASC function contains twice as many                           HEXASC                          0016                                characters as the string-argument (because each byte of the                        HEXASC                          0017                                string-argument will be represented by 2 bytes in ASCII).                          HEXASC                          0018                                                                                                                   HEXASC                          0019                                Note: The <ASCHEX> function provides the opposite function of                      HEXASC                          0020                                HEXASC (ASCHEX converts an ASCII hex string to its equivalent                      HEXASC                          0021                                ASCII value).                                                                      HEXASC                          0022                                                                                                                   HEXASC                          0023                              Example:                                                                             HEXASC                          0024                                                                                                                   HEXASC                          0025                                VALUE$ = HEXASC(STR$)                                                              HEXASC                          0026                                                                                                                   HEXASC                          0027                                In the above example, the value contained in string variable STR$                  HEXASC                          0028                                is converted to its ASCII hex equivalent; the result is stored in                  HEXASC                          0029                                the variable VALUE$.                                                               HEXASC                          0030                                                                                                                   HEXASC                          0031                                For example, if STR$ equals "COMET", then VALUE$ will equal                        HEXASC                          0032                                "434F4D4554" (because the ASCII hex equivalent of "C" is "43",                     HEXASC                          0033                                the ASCII hex equivalent of "O" is "4F", the ASCII hex equivalent                  HEXASC                          0034                                of "M" is "4D", etc.).                                                             HEXASC                          0035                                                                                                                   HEXASC                          0036                                Likewise, if STR$ equals "123", then VALUE$ will equal "313233"                    HEXASC                          0037                                (the ASCII hex equivalents of the characters "1", "2", and "3").                   HEXDEC                          0001                              Syntax:                                                                              HEXDEC                          0002                                                                                                                   HEXDEC                          0003                                HEXDEC(string-argument)                                                            HEXDEC                          0004                                                                                                                   HEXDEC                          0005                              Discussion:                                                                          HEXDEC                          0006                                                                                                                   HEXDEC                          0007                                The HEXDEC function converts a two-byte binary string to its                       HEXDEC                          0008                                decimal equivalent.                                                                HEXDEC                          0009                                                                                                                   HEXDEC                          0010                                The string-argument represents the two-byte binary string to be                    HEXDEC                          0011                                converted. The string-argument may be a string constant, a                         HEXDEC                          0012                                single-element string variable, a string array element, a string                   HEXDEC                          0013                                expression, or a string function.                                                  HEXDEC                          0014                                                                                                                   HEXDEC                          0015                                The maximum possible value returned by the HEXDEC function is                      HEXDEC                          0016                                65,535, the decimal equivalent of "@FFFF@" hex.                                    HEXDEC                          0017                                                                                                                   HEXDEC                          0018                                See <DECHEX> and <ASC>.                                                            HEXDEC                          0019                                                                                                                   HEXDEC                          0020                              Example 1:                                                                           HEXDEC                          0021                                                                                                                   HEXDEC                          0022                                VALUE = HEXDEC(STR$)                                                               HEXDEC                          0023                                                                                                                   HEXDEC                          0024                                In the above example, the two-byte value contained in variable                     HEXDEC                          0025                                STR$ is converted to its decimal equivalent. The result is stored                  HEXDEC                          0026                                in numeric variable VALUE.                                                         HEXDEC                          0027                                                                                                                   HEXDEC                          0028                                For example, if STR$ equals "@3039@" hex, then VALUE will equal                    HEXDEC                          0029                                12,345 (the decimal equivalent of hex "3039").                                     HEXDEC                          0030                                                                                                                   HEXDEC                          0031                                Or, if STR$ equals "@FFFF@" hex, then VALUE will equal 65,535                      HEXDEC                          0032                                (the decimal equivalent of hex "FFFF").                                            HEXDEC                          0033                                                                                                                   HEXDEC                          0034                              Example 2:                                                                           HEXDEC                          0035                                                                                                                   HEXDEC                          0036                                VALUE = HEXDEC(SUB(STR$,1,1))                                                      HEXDEC                          0037                                                                                                                   HEXDEC                          0038                                In this example, the first byte of the variable STR$ is converted                  HEXDEC                          0039                                to its decimal equivalent. This statement produces the same                        HEXDEC                          0040                                result as:                                                                         HEXDEC                          0041                                                                                                                   HEXDEC                          0042                                   VALUE = ASC(STR$)                                                               HOME                            0001                              Table of Contents                                                                    HOME                            0002                              =================                                                                    HOME                            0003                                                                                                                   HOME                            0004                                <Introduction to MoreThanBasic,#HELPMT2>                                           HOME                            0005                                <Language Structure,#HELPMT2>                                                      HOME                            0006                                   <Data Division,#HELPMT3>                                                        HOME                            0007                                   <I/O Format Division,#HELPMT3>                                                  HOME                            0008                                   <Procedure Division,#HELPMT4>                                                   HOME                            0009                                <Overview of the Comet File System,#HELPMT2>                                       HOME                            0010                                <Using the MTB Compiler,#HELPMT2>                                                  HOME                            0011                                <MTB Applications,#HELPMT5>                                                        HOME                            0012                                <Instant Reference Guide,#HELPMT6>                                                 HOME                            0013                                <Index|INDEX,#HELPMTB>                                                             IF                              0001                              Syntax:                                                                              IF                              0002                                                                                                                   IF                              0003                                IF relational-expression [THEN] conditional-statement(s)                           IF                              0004                                                                                                                   IF                              0005                                (or)                                                                               IF                              0006                                                                                                                   IF                              0007                                IF relational-expression [THEN]                                                    IF                              0008                                conditional-statement(s)                                                           IF                              0009                                ELSE                                                                               IF                              0010                                conditional-statement(s)                                                           IF                              0011                                ENDIF                                                                              IF                              0012                                                                                                                   IF                              0013                              Discussion:                                                                          IF                              0014                                                                                                                   IF                              0015                                There are two forms of the IF statement.                                           IF                              0016                                                                                                                   IF                              0017                                a. The IF/THEN statement evaluates a relational-expression and,                    IF                              0018                                   if the result is true, executes the conditional-statement(s).                   IF                              0019                                   If the relational-expression produces a false result, the                       IF                              0020                                   conditional-statements are not executed; program flow                           IF                              0021                                   continues with the next statement.                                              IF                              0022                                                                                                                   IF                              0023                                   Note: In MTB, the keyword "THEN" is not required. However, for                  IF                              0024                                   the sake of program readability, we recommend using it.                         IF                              0025                                                                                                                   IF                              0026                                b. Like the simple IF/THEN statement, the IF/THEN/ELSE/ENDIF                       IF                              0027                                   statements begin with the evaluation of a relational-                           IF                              0028                                   expression. If the relational-expression yields a true result,                  IF                              0029                                   the conditional-statement(s) on the following source lines are                  IF                              0030                                   executed.                                                                       IF                              0031                                                                                                                   IF                              0032                                   Unlike the simple IF/THEN statement, multiple conditional-                      IF                              0033                                   statement(s) are not separated with an ampersand or continued                   IF                              0034                                   with an underline character.                                                    IF                              0035                                                                                                                   IF                              0036                                   If the structure contains an ELSE statement, statements up to                   IF                              0037                                   the keyword "ELSE" are executed if the relational-expression                    IF                              0038                                   is true. If the relational-expression yields a false result,                    IF                              0039                                   statements following the keyword "ELSE" up to the keyword                       IF                              0040                                   "ENDIF" are executed.                                                           IF                              0041                                                                                                                   IF                              0042                                The word THEN is optional, but the words ELSE and ENDIF are                        IF                              0043                                mandatory and must be the only statements on the source program                    IF                              0044                                line.                                                                              IF                              0045                                                                                                                   IF                              0046                                A relational-expression consists of three elements: a variable                     IF                              0047                                name, a relational operator, and a comparison value. For example,                  IF                              0048                                to determine if a variable named CRLIMIT has a value greater than                  IF                              0049                                500, you would use the following relational-expression:                            IF                              0050                                                                                                                   IF                              0051                                   CRLIMIT GT 500                                                                  IF                              0052                                                                                                                   IF                              0053                                In relational-expressions, the variable name always appears                        IF                              0054                                first, followed by a relational-operator from the following list:                  IF                              0055                                                                                                                   IF                              0056                                   Relational operator      MTB syntax                                             IF                              0057                                   ==========================================                                      IF                              0058                                   Equal to                 EQ  or  =                                              IF                              0059                                   Not equal to             NE  or  NOT=                                           IF                              0060                                   Greater than             GT  or  >                                              IF                              0061                                   Greater than or equal to GE  or  >=                                             IF                              0062                                   Less than                LT  or  <                                              IF                              0063                                   Less than or equal to    LE  or  <=                                             IF                              0064                                                                                                                   IF                              0065                                The comparison value is the third item in a relational-                            IF                              0066                                expression. It may be a constant or variable and must agree in                     IF                              0067                                data type with the variable name (i.e., strings must be compared                   IF                              0068                                to strings, numbers to numbers).                                                   IF                              0069                                                                                                                   IF                              0070                                Compound relational-expressions may be defined with the AND and                    IF                              0071                                OR parameters. These link individual relational-expressions --                     IF                              0072                                the outcome is based on the joint outcome as follows:                              IF                              0073                                                                                                                   IF                              0074                                   Parameter Conditions                    Outcome                                 IF                              0075                                                                                                                   IF                              0076                                   AND       both conditions are true      result is true                          IF                              0077                                                                                                                   IF                              0078                                   AND       at least one condition is false    result is false                    IF                              0079                                                                                                                   IF                              0080                                   OR        either condition is true      result is true                          IF                              0081                                                                                                                   IF                              0082                                   OR        both conditions are false          result is false                    IF                              0083                                                                                                                   IF                              0084                                In compound expressions containing AND and OR, the AND parameter                   IF                              0085                                takes precedence (much like multiplication and division take                       IF                              0086                                precedence over addition and subtraction in a compound numeric                     IF                              0087                                expression).                                                                       IF                              0088                                                                                                                   IF                              0089                                If multiple conditional-statements are to be executed, they must                   IF                              0090                                be separated with the ampersand character (&). If these                            IF                              0091                                statements exceed the length of a single editor line, they must                    IF                              0092                                be continued with the underline character (_). For an alternative                  IF                              0093                                syntax, see the IF/THEN/ELSE statement on the following pages.                     IF                              0094                                                                                                                   IF                              0095                              Example 1:                                                                           IF                              0096                                                                                                                   IF                              0097                                IF FLAG$ = "Y" THEN GOTO 9999                                                      IF                              0098                                                                                                                   IF                              0099                              Example 2:                                                                           IF                              0100                                                                                                                   IF                              0101                                IF A=B AND B=C THEN PRINT (0) "VALUES ARE ALL EQUAL."                              IF                              0102                                                                                                                   IF                              0103                              Example 3:                                                                           IF                              0104                                                                                                                   IF                              0105                                If A=B OR B=C THEN PRINT (0) "SOME VALUES ARE EQUAL."                              IF                              0106                                                                                                                   IF                              0107                              Example 4:                                                                           IF                              0108                                                                                                                   IF                              0109                                IF OPTION$="QUIT" THEN_                                                            IF                              0110                                PRINT (0) "NOW ENDING PROGRAM" &_                                                  IF                              0111                                CLOSE (1) & CLOSE (2) &_                                                           IF                              0112                                RUN "QMONITOR"                                                                     IF                              0113                                                                                                                   IF                              0114                              Example 5:                                                                           IF                              0115                                                                                                                   IF                              0116                                IF OPTION$="QUIT" THEN                                                             IF                              0117                                   PRINT (0) "NOW ENDING PROGRAM"                                                  IF                              0118                                   CLOSE (1) & CLOSE (2)                                                           IF                              0119                                   RUN "QMONITOR"                                                                  IF                              0120                                ELSE                                                                               IF                              0121                                   PRINT (0) "PLEASE ENTER OPTION AGAIN:"                                          IF                              0122                                   INPUT (0) OPTION$                                                               IF                              0123                                   GOTO 500                                                                        IF                              0124                                ENDIF                                                                              INPUT                           0001                              Syntax:                                                                              INPUT                           0002                                                                                                                   INPUT                           0003                                INPUT (lun) variable-list [,EXCP=statement-label]                                  INPUT                           0004                                                                                                                   INPUT                           0005                              Discussion:                                                                          INPUT                           0006                                                                                                                   INPUT                           0007                                The INPUT statement allows simple, unformatted input into                          INPUT                           0008                                specified variables without referencing a <FORMAT,#HELPMT3>                        INPUT                           0009                                statement.                                                                         INPUT                           0010                                                                                                                   INPUT                           0011                                The variable-list consists of one or more variable names,                          INPUT                           0012                                separated by semicolons.                                                           INPUT                           0013                                                                                                                   INPUT                           0014                                Note: Each variable in a multi-variable list requires a separate                   INPUT                           0015                                operator transmission (see <I/O Format Division,#HELPMT3> for                      INPUT                           0016                                more information).                                                                 INPUT                           0017                                                                                                                   INPUT                           0018                                The length of a string field is governed by its current length,                    INPUT                           0019                                and not by the declared length. Because unformatted input is                       INPUT                           0020                                given field-by-field, trailing blanks are stripped from each                       INPUT                           0021                                string variable in the list. This is unlike the <READ> statement                   INPUT                           0022                                where trailing blanks are stripped only from the last string                       INPUT                           0023                                variable listed in the FORMAT statement, and all variables are                     INPUT                           0024                                input with a single transmission.                                                  INPUT                           0025                                                                                                                   INPUT                           0026                                Using INPUT with a single variable is a convenient way to cause                    INPUT                           0027                                the system to strip the trailing blanks. As the record is placed                   INPUT                           0028                                in the variable (string), the current length is adjusted for the                   INPUT                           0029                                blank stripping.                                                                   INPUT                           0030                                                                                                                   INPUT                           0031                                If you do not include a decimal point in a numeric variable, it                    INPUT                           0032                                is automatically inserted according to the declared precision of                   INPUT                           0033                                the variable. Excess characters are truncated on the left.                         INPUT                           0034                                                                                                                   INPUT                           0035                                If you do include a decimal point in a numeric variable, INPUT                     INPUT                           0036                                will adjust it with the declared precision. Excess characters (on                  INPUT                           0037                                both the left and the right) are truncated.                                        INPUT                           0038                                                                                                                   INPUT                           0039                                Although unformatted INPUT is primarily used for video terminal                    INPUT                           0040                                input, it can also be used for multiple sequential reads of any                    INPUT                           0041                                type of file into a list of single variables, one for each                         INPUT                           0042                                record.                                                                            INPUT                           0043                                                                                                                   INPUT                           0044                                INPUT can also refer to a FORMAT statement. It functions the same                  INPUT                           0045                                way as a non-indexed READ statement. In this case, the syntax is:                  INPUT                           0046                                                                                                                   INPUT                           0047                                   INPUT (lun,format-statement-label) [,EXCP=statement number]                     INPUT                           0048                                                                                                                   INPUT                           0049                              Example 1:                                                                           INPUT                           0050                                                                                                                   INPUT                           0051                                PRINT (0) "ENTER CUSTOMER NAME:" ! Display prompt                                  INPUT                           0052                                INPUT (0) CUSTNAME$              ! Enter data                                      INPUT                           0053                                                                                                                   INPUT                           0054                                                                                                                   INPUT                           0055                              Example 2:                                                                           INPUT                           0056                                                                                                                   INPUT                           0057                                1000 FORMAT NAME$;ADDRESS$;CITY$;STATE:ZIP$                                        INPUT                           0058                                .                                                                                  INPUT                           0059                                .                                                                                  INPUT                           0060                                .                                                                                  INPUT                           0061                                PRINT (0,500)     ! Formatted screen                                               INPUT                           0062                                INPUT (0,1000)    ! Input items in FORMAT statement                                INPUT                           0063                                                                                                                   INPUT                           0064                              Example 3:                                                                           INPUT                           0065                                                                                                                   INPUT                           0066                                INPUT (0) A$;B$;C$                                                                 INPUT                           0067                                                                                                                   INPUT                           0068                                (or)                                                                               INPUT                           0069                                                                                                                   INPUT                           0070                                100 FORMAT A$;B$;C$                                                                INPUT                           0071                                .                                                                                  INPUT                           0072                                .                                                                                  INPUT                           0073                                .                                                                                  INPUT                           0074                                INPUT (0,100)                                                                      INPUT                           0075                                                                                                                   INPUT                           0076                                The first INPUT statement requires a separate transmission for                     INPUT                           0077                                each of the three fields. Also, blanks are stripped from each                      INPUT                           0078                                field. In the second example, only one transmission is required                    INPUT                           0079                                (as shown by the single INPUT statement). In this case, blanks                     INPUT                           0080                                are stripped only from the final field (C$ in the above example).                  INQUIRE                         0001                              Syntax:                                                                              INQUIRE                         0002                                                                                                                   INQUIRE                         0003                                INQUIRE (lun, format-statement-label) [KEY=index]                                  INQUIRE                         0004                                        [,EXCP=statement-label]                                                    INQUIRE                         0005                                                                                                                   INQUIRE                         0006                              Discussion:                                                                          INQUIRE                         0007                                                                                                                   INQUIRE                         0008                                The INQUIRE statement performs the same function as the <READ>                     INQUIRE                         0009                                statement, and is able to retrieve records that have been                          INQUIRE                         0010                                extracted. The INQUIRE statement is available in Comet 504 and                     INQUIRE                         0011                                greater (i.e., executing the INQUIRE statement under previous                      INQUIRE                         0012                                versions of Comet generates an exception 91).                                      INQUIRE                         0013                                                                                                                   INQUIRE                         0014                                Notes:                                                                             INQUIRE                         0015                                                                                                                   INQUIRE                         0016                                a. The optional index parameter is used to access a particular                     INQUIRE                         0017                                   record in a keyed file. If an index is not specified, the file                  INQUIRE                         0018                                   is read in key-sequential order.                                                INQUIRE                         0019                                                                                                                   INQUIRE                         0020                                b. When the index parameter is used, the index (key) can be any                    INQUIRE                         0021                                   valid string expression. If the key index is shorter than the                   INQUIRE                         0022                                   file key size, it is padded with trailing blanks prior to the                   INQUIRE                         0023                                   key search. If it is longer than the key size, excess trailing                  INQUIRE                         0024                                   characters are truncated prior to the key search. If the key                    INQUIRE                         0025                                   index is not found in the key list, the file pointer is                         INQUIRE                         0026                                   positioned at the next key and an exception 32 is encountered.                  INQUIRE                         0027                                                                                                                   INQUIRE                         0028                                c. The INQUIRE statement automatically advances the file pointer                   INQUIRE                         0029                                   to the next record in the file.                                                 INQUIRE                         0030                                                                                                                   INQUIRE                         0031                              Example:                                                                             INQUIRE                         0032                                                                                                                   INQUIRE                         0033                                OPEN (1) "CUSTFILE"                                                                INQUIRE                         0034                                .                                                                                  INQUIRE                         0035                                INPUT (0) CUSTNUM$                                                                 INQUIRE                         0036                                INQUIRE (1,1000) KEY=CUSTNUM$, EXCP=9999                                           INSERT                          0001                              Syntax:                                                                              INSERT                          0002                                                                                                                   INSERT                          0003                                INSERT (lun, format-statement-label) KEY=index                                     INSERT                          0004                                       [,EXCP=statement-label]                                                     INSERT                          0005                                                                                                                   INSERT                          0006                              Discussion:                                                                          INSERT                          0007                                                                                                                   INSERT                          0008                                The INSERT statement functions just like a <WRITE> statement                       INSERT                          0009                                except that an exception 56 (RECORD ALREADY EXISTS FOR INSERT) is                  INSERT                          0010                                encountered if the key index being inserted already exists.                        INSERT                          0011                                INSERT is used only on keyed files.                                                INSERT                          0012                                                                                                                   INSERT                          0013                                The index parameter is the value of the key that is being                          INSERT                          0014                                inserted. This can be a string constant or a string variable.                      INSERT                          0015                                                                                                                   INSERT                          0016                                Image records can be inserted with the INSERTIMAGE statement.                      INSERT                          0017                                                                                                                   INSERT                          0018                                The syntax is:                                                                     INSERT                          0019                                                                                                                   INSERT                          0020                                   INSERTIMAGE (lun, format-statement-label) KEY=index                             INSERT                          0021                                               [,EXCP=statement-label]                                             INSERT                          0022                                                                                                                   INSERT                          0023                              Example:                                                                             INSERT                          0024                                                                                                                   INSERT                          0025                                INSERT (1,1000) KEY=CUSTNUM$,EXCP=9999                                             INT                             0001                              Syntax:                                                                              INT                             0002                                                                                                                   INT                             0003                                INT(numeric-argument)                                                              INT                             0004                                                                                                                   INT                             0005                              Discussion:                                                                          INT                             0006                                                                                                                   INT                             0007                                The INT function returns the integer portion of a numeric-                         INT                             0008                                argument. The value returned by the INT function is always a                       INT                             0009                                whole number (integer) and always carries the same sign as the                     INT                             0010                                numeric-argument.                                                                  INT                             0011                                                                                                                   INT                             0012                                The numeric-argument may be a numeric constant, a single-element                   INT                             0013                                numeric variable, a numeric array element, a numeric expression,                   INT                             0014                                or a numeric function.                                                             INT                             0015                                                                                                                   INT                             0016                                The intermediate result of the INT function is stored in a                         INT                             0017                                numeric accumulator with a length and precision of 16.0. If this                   INT                             0018                                intermediate result is then moved to a receiving numeric                           INT                             0019                                variable, its precision is automatically adjusted to the defined                   INT                             0020                                precision of that variable.                                                        INT                             0021                                                                                                                   INT                             0022                                Also see <FPT>.                                                                    INT                             0023                                                                                                                   INT                             0024                              Example:                                                                             INT                             0025                                                                                                                   INT                             0026                                A = INT(B)                                                                         INT                             0027                                                                                                                   INT                             0028                                In the above example, the integer portion of numeric variable B                    INT                             0029                                is moved to numeric variable A. For example, if B equals 27.43,                    INT                             0030                                then A equals 27.                                                                  INTERRUPT                       0001                              Syntax:                                                                              INTERRUPT                       0002                                                                                                                   INTERRUPT                       0003                                INTERRUPT partition [,EXCP=statement-label]                                        INTERRUPT                       0004                                                                                                                   INTERRUPT                       0005                              Discussion:                                                                          INTERRUPT                       0006                                                                                                                   INTERRUPT                       0007                                The INTERRUPT statement forces the named partition to branch to                    INTERRUPT                       0008                                the <MESSAGESUB> path in the program.                                              INTERRUPT                       0009                                                                                                                   INTERRUPT                       0010                                When INTERRUPT is executed, the contents of the system variable                    INTERRUPT                       0011                                named <MESSAGE$,#HELPMT3> for the interrupting partition is                        INTERRUPT                       0012                                passed to MESSAGE$ in the interrupted partition. If the partition                  INTERRUPT                       0013                                to be interrupted does not have a MESSAGESUB path set, an                          INTERRUPT                       0014                                exception 70 is returned to the interrupting partition.                            INTERRUPT                       0015                                                                                                                   INTERRUPT                       0016                                INTERRUPT works for both background and foreground partitions.                     INTERRUPT                       0017                                                                                                                   INTERRUPT                       0018                                Application note:                                                                  INTERRUPT                       0019                                                                                                                   INTERRUPT                       0020                                Because INTERRUPT passes the contents of MESSAGE$, true inter-                     INTERRUPT                       0021                                partition communications can occur under Comet. The INTERRUPT                      INTERRUPT                       0022                                statement can be used in conjunction with <PAUSE> and <WAKEUP> to                  INTERRUPT                       0023                                dynamically control the system job stream.                                         INTERRUPT                       0024                                                                                                                   INTERRUPT                       0025                              Example 1:                                                                           INTERRUPT                       0026                                                                                                                   INTERRUPT                       0027                                INTERRUPT "P01",EXCP=2000                                                          INTERRUPT                       0028                                                                                                                   INTERRUPT                       0029                                In this example, the partition named "P01" is interrupted and                      INTERRUPT                       0030                                forced to branch to the MESSAGESUB address (if it contains one).                   INTERRUPT                       0031                                The value of the system variable MESSAGE$ is passed from the                       INTERRUPT                       0032                                current partition to the interrupted partition.                                    INTERRUPT                       0033                                                                                                                   INTERRUPT                       0034                              Example 2:                                                                           INTERRUPT                       0035                                                                                                                   INTERRUPT                       0036                                INTERRUPT P$, EXCP=2000                                                            INTERRUPT                       0037                                                                                                                   INTERRUPT                       0038                                In this example, the partition name is specified with a string                     INTERRUPT                       0039                                variable. For this statement to function correctly, the variable                   INTERRUPT                       0040                                will have to contain a valid partition name -- one that is to be                   INTERRUPT                       0041                                interrupted.                                                                       KEY                             0001                              Syntax:                                                                              KEY                             0002                                                                                                                   KEY                             0003                                KEY(lun [,EXCP=statement-label])                                                   KEY                             0004                                                                                                                   KEY                             0005                              Discussion:                                                                          KEY                             0006                                                                                                                   KEY                             0007                                The KEY function returns the value of the next key in the keyed                    KEY                             0008                                file open on the specified logical unit number. The next key is                    KEY                             0009                                the key following the position of the record pointer. (Keys are                    KEY                             0010                                stored in <ASCII> order.)                                                          KEY                             0011                                                                                                                   KEY                             0012                                Notes:                                                                             KEY                             0013                                                                                                                   KEY                             0014                                1. The KEY function is valid only for keyed files.                                 KEY                             0015                                                                                                                   KEY                             0016                                2. If the KEY function is attempted on an empty keyed file, an                     KEY                             0017                                   exception 2 (END OF FILE) will be reported.                                     KEY                             0018                                                                                                                   KEY                             0019                                3. If the record pointer is currently at the last record in the                    KEY                             0020                                   file, the KEY function will result an exception 2.                              KEY                             0021                                                                                                                   KEY                             0022                                4. The KEY function does not move the record pointer.                              KEY                             0023                                                                                                                   KEY                             0024                              Example:                                                                             KEY                             0025                                                                                                                   KEY                             0026                                OPEN (1) "SALES"                                                                   KEY                             0027                                .                                                                                  KEY                             0028                                .                                                                                  KEY                             0029                                .                                                                                  KEY                             0030                                NEXTKEY$ = KEY(1,EXCP=9999)                                                        KEY                             0031                                                                                                                   KEY                             0032                                In the above example, the KEY function is used to determine the                    KEY                             0033                                value of the next key in the SALES file. The resulting value                       KEY                             0034                                depends upon the statements between the opening of the file (when                  KEY                             0035                                the pointer is positioned at the beginning of the file) and the                    KEY                             0036                                execution of the KEY function.                                                     KEY=                            0001  Key index                   Key index                                                                            KEY=                            0002  Key index                   =========                                                                            KEY=                            0003  Key index                   Parameter:                                                                           KEY=                            0004  Key index                                                                                                        KEY=                            0005  Key index                     KEY=key-index                                                                      KEY=                            0006  Key index                                                                                                        KEY=                            0007  Key index                   Discussion:                                                                          KEY=                            0008  Key index                                                                                                        KEY=                            0009  Key index                     Used in input/output statements to specify the key index or                        KEY=                            0010  Key index                     record number being accessed (read or written). If the key-index                   KEY=                            0011  Key index                     is a string, it refers to an alphanumeric key in a keyed file. If                  KEY=                            0012  Key index                     the key-index is a number, it refers to the record number in a                     KEY=                            0013  Key index                     keyed or indexed sequential file.                                                  KEY=                            0014  Key index                                                                                                        KEY=                            0015  Key index                     For keyed files, the key-index can be any valid string                             KEY=                            0016  Key index                     expression. If the key-index is shorter than the file key size,                    KEY=                            0017  Key index                     it is padded with trailing blanks. If it is longer than the key                    KEY=                            0018  Key index                     size, excess trailing characters are truncated before the key                      KEY=                            0019  Key index                     search begins. If the key-index is not found in the key list, the                  KEY=                            0020  Key index                     record pointer is positioned at the next key and the exception                     KEY=                            0021  Key index                     path is executed. This is useful for finding a particular record                   KEY=                            0022  Key index                     for which you may know only the beginning part of the key.                         KEY=                            0023  Key index                                                                                                        KEY=                            0024  Key index                     For indexed sequential files, the key-index can be any numeric                     KEY=                            0025  Key index                     expression (truncated to an integer value before the READ is                       KEY=                            0026  Key index                     attempted). A negative or zero index, or an index beyond the last                  KEY=                            0027  Key index                     record in the file, results in an exception branch.                                KEY=                            0028  Key index                                                                                                        KEY=                            0029  Key index                     For more information, see <Exception Handling>.                                    KEY=                            0030  Key index                                                                                                        KEY=                            0031  Key index                   Example:                                                                             KEY=                            0032  Key index                                                                                                        KEY=                            0033  Key index                             INPUT (0) CUSTNUM$                      ! ENTER CUST. NO.                  KEY=                            0034  Key index                             READ (1,1000) KEY=CUSTNUM$, EXCP=LABEL2 ! READ RECORD                      KEY=                            0035  Key index                             .                                                                          KEY=                            0036  Key index                     LABEL2: IF EXCP = 32 THEN ...         ! KEY NOT FOUND EXCEPTION                    KEY=                            0037  Key index                             IF EXCP = 33 THEN ...         ! RECORD LOCKED EXCEPTION                    KILL                            0001                              Syntax:                                                                              KILL                            0002                                                                                                                   KILL                            0003                                KILL partition [,EXCP=statement-label]                                             KILL                            0004                                                                                                                   KILL                            0005                              Discussion:                                                                          KILL                            0006                                                                                                                   KILL                            0007                                The KILL statement terminates a partition. The program running in                  KILL                            0008                                the specified partition is stopped and the partition is forced to                  KILL                            0009                                run the QMONITOR program.                                                          KILL                            0010                                                                                                                   KILL                            0011                                The partition parameter is a string value (constant or variable)                   KILL                            0012                                in the form "Pnn" (where "nn" is a value from 00 to 99).                           KILL                            0013                                                                                                                   KILL                            0014                                The KILL statement is similar to the <TERMINATE> statement, but                    KILL                            0015                                overrides all exception handling for the partition. In this                        KILL                            0016                                sense, KILL is more powerful than TERMINATE.                                       KILL                            0017                                                                                                                   KILL                            0018                                KILL closes all files for the named partition, but offers no                       KILL                            0019                                graceful way to control shutdown.                                                  KILL                            0020                                                                                                                   KILL                            0021                              Example 1:                                                                           KILL                            0022                                                                                                                   KILL                            0023                                KILL "P05",EXCP=9000                                                               KILL                            0024                                                                                                                   KILL                            0025                                In the above example, partition P05 is terminated with the KILL                    KILL                            0026                                statement. The program running in partition P05, if any, is                        KILL                            0027                                terminated and the partition is forced to run the QMONITOR                         KILL                            0028                                program. All exception handling routines in the program running                    KILL                            0029                                in partition P05 are overridden.                                                   KILL                            0030                                                                                                                   KILL                            0031                              Example 2:                                                                           KILL                            0032                                                                                                                   KILL                            0033                                INPUT (0) "ENTER PARTITION TO KILL:";PART$                                         KILL                            0034                                KILL PART$,EXCP=9999                                                               KILL                            0035                                                                                                                   KILL                            0036                                In this example, the user-supplied partition name is terminated.                   KILL                            0037                                In other words, the value entered by the user in response to the                   KILL                            0038                                INPUT prompt will be substituted into the KILL statement and the                   KILL                            0039                                program running in that partition (if any) will be terminated.                     LAST                            0001                              Syntax:                                                                              LAST                            0002                                                                                                                   LAST                            0003                                LAST(lun, [,EXCP=statement-label])                                                 LAST                            0004                                                                                                                   LAST                            0005                              Discussion:                                                                          LAST                            0006                                                                                                                   LAST                            0007                                The LAST function returns the value of the last key in the file                    LAST                            0008                                that is open on the specified logical unit number (<lun>). The                     LAST                            0009                                last key is the highest <ASCII> valued key contained in the file.                  LAST                            0010                                                                                                                   LAST                            0011                                Notes:                                                                             LAST                            0012                                                                                                                   LAST                            0013                                1. The LAST function is valid only for keyed files.                                LAST                            0014                                                                                                                   LAST                            0015                                2. If the LAST function is attempted on an empty keyed file, an                    LAST                            0016                                   exception 2 (END OF FILE) will be reported.                                     LAST                            0017                                                                                                                   LAST                            0018                                3. The LAST function does not move the record pointer.                             LAST                            0019                                                                                                                   LAST                            0020                                Also see <FIRST>.                                                                  LAST                            0021                                                                                                                   LAST                            0022                              Example:                                                                             LAST                            0023                                                                                                                   LAST                            0024                                OPEN (1) "SALES"                                                                   LAST                            0025                                LASTKEY$ = LAST(1,EXCP=9999)                                                       LAST                            0026                                                                                                                   LAST                            0027                                In the above example, the LAST function is used to determine the                   LAST                            0028                                value of the last key in the SALES file. If an exception occurs                    LAST                            0029                                when this statement is executed, program control will transfer to                  LAST                            0030                                exception-statement-label 9999.                                                    LCASE                           0001                              Syntax:                                                                              LCASE                           0002                                                                                                                   LCASE                           0003                                LCASE(string-argument)                                                             LCASE                           0004                                                                                                                   LCASE                           0005                              Discussion:                                                                          LCASE                           0006                                                                                                                   LCASE                           0007                                The LCASE function converts upper case characters in a string-                     LCASE                           0008                                argument to lower case characters. Other characters in the                         LCASE                           0009                                string-argument (e.g., lower case characters, special characters)                  LCASE                           0010                                remain unchanged.                                                                  LCASE                           0011                                                                                                                   LCASE                           0012                                The string-argument may be a string constant, a single-element                     LCASE                           0013                                string variable, a string array element, a string expression, or                   LCASE                           0014                                a string function.                                                                 LCASE                           0015                                                                                                                   LCASE                           0016                                Also see <UCASE>.                                                                  LCASE                           0017                                                                                                                   LCASE                           0018                              Example 1:                                                                           LCASE                           0019                                                                                                                   LCASE                           0020                                Y$ = LCASE(X$)                                                                     LCASE                           0021                                                                                                                   LCASE                           0022                                In the above example, any upper case characters contained in X$                    LCASE                           0023                                are converted to lower case and the entire string is moved to Y$.                  LCASE                           0024                                For example, if X$ equals "Signature Systems" then Y$ will equal                   LCASE                           0025                                "signature systems".                                                               LCASE                           0026                                                                                                                   LCASE                           0027                              Example 2:                                                                           LCASE                           0028                                                                                                                   LCASE                           0029                                INPUT (0) ANSWER$                                                                  LCASE                           0030                                IF LCASE(ANSWER$) = "y" THEN GOTO 9000                                             LCASE                           0031                                                                                                                   LCASE                           0032                                In this example, the variable ANSWER$ is used to receive input                     LCASE                           0033                                data from the terminal (logical unit 0). The data is then                          LCASE                           0034                                converted to lower case and compared to "y". If it equals "y" the                  LCASE                           0035                                program branches to statement 9000. Otherwise, program flow                        LCASE                           0036                                continues below the IF statement.                                                  LEN                             0001                              Syntax:                                                                              LEN                             0002                                                                                                                   LEN                             0003                                LEN(string-argument)                                                               LEN                             0004                                                                                                                   LEN                             0005                              Discussion:                                                                          LEN                             0006                                                                                                                   LEN                             0007                                The LEN function returns the current number of characters that                     LEN                             0008                                are currently stored in the string-argument, regardless of the                     LEN                             0009                                defined length of the string-argument. The value returned by the                   LEN                             0010                                LEN function is called the "current length" of the string-                         LEN                             0011                                argument.                                                                          LEN                             0012                                                                                                                   LEN                             0013                                The current length may be different than the defined length                        LEN                             0014                                depending on how the field was filled. If the field was filled                     LEN                             0015                                from the keyboard, and if blanks were stripped from the field at                   LEN                             0016                                input time, the current length will be less than or equal to the                   LEN                             0017                                defined length. But, if the field was filled from a data file                      LEN                             0018                                (where there is no blank stripping), the current length will                       LEN                             0019                                equal the defined length.                                                          LEN                             0020                                                                                                                   LEN                             0021                                The string-argument may be a string constant, a single-element                     LEN                             0022                                string variable, a string array element, a string expression, or                   LEN                             0023                                a string function.                                                                 LEN                             0024                                                                                                                   LEN                             0025                                Note: If the string-argument is a string variable, the length of                   LEN                             0026                                the resultant value may be less than or equal to (but never                        LEN                             0027                                greater than) the defined length of the string variable.                           LEN                             0028                                                                                                                   LEN                             0029                                The intermediate result of the LEN function is stored in a                         LEN                             0030                                numeric accumulator with a precision of 16.0. If this                              LEN                             0031                                intermediate result is then moved to a receiving numeric                           LEN                             0032                                variable, its precision is automatically adjusted to the defined                   LEN                             0033                                precision of that variable.                                                        LEN                             0034                                                                                                                   LEN                             0035                                Also see <LENGTH,#HELPMT3>.                                                        LEN                             0036                                                                                                                   LEN                             0037                              Example:                                                                             LEN                             0038                                                                                                                   LEN                             0039                                LENGTH 30 & LOCAL A$                                                               LEN                             0040                                .                                                                                  LEN                             0041                                N = LEN(A$)                                                                        LEN                             0042                                                                                                                   LEN                             0043                                In the above example, the current length of the string variable                    LEN                             0044                                A$ is moved to the numeric variable N. A$ is defined with a                        LEN                             0045                                length of 30 characters, but assume that its current value is                      LEN                             0046                                "Signature" followed by 21 nulls. In this case N will equal 9.                     LET                             0001                              Syntax:                                                                              LET                             0002                                                                                                                   LET                             0003                                [LET] string-variable = string-expression                                          LET                             0004                                                                                                                   LET                             0005                                (or)                                                                               LET                             0006                                                                                                                   LET                             0007                                [LET] numeric-variable = numeric-expression                                        LET                             0008                                                                                                                   LET                             0009                              Discussion:                                                                          LET                             0010                                                                                                                   LET                             0011                                The LET statement assigns a value to a string variable or a                        LET                             0012                                numeric variable. There are two forms of the LET statement: one                    LET                             0013                                for string variables and another for numeric variables. In both                    LET                             0014                                cases, the word "LET" itself is optional.                                          LET                             0015                                                                                                                   LET                             0016                                In the first format, the string-variable is a single-element                       LET                             0017                                string variable or a string array element. The string-expression                   LET                             0018                                is a string constant, single-element string variable, string                       LET                             0019                                array element, string function or string expression. The result                    LET                             0020                                of the string-expression is moved into the string-variable                         LET                             0021                                (sometimes referred to as the "receiving variable").                               LET                             0022                                                                                                                   LET                             0023                                If the string-expression results in more characters than are                       LET                             0024                                defined for the receiving string, the value will be truncated on                   LET                             0025                                the right side.                                                                    LET                             0026                                                                                                                   LET                             0027                                Note: Only one <SUB> function is permitted in a string-expression                  LET                             0028                                that is to be concatenated and stored as the value of the string                   LET                             0029                                variable.                                                                          LET                             0030                                                                                                                   LET                             0031                                In the second format shown above, the numeric-variable is a                        LET                             0032                                single-element numeric variable or a numeric array element. The                    LET                             0033                                numeric-expression may be a numeric constant, a single-element                     LET                             0034                                numeric variable, a numeric array element, a numeric function or                   LET                             0035                                a numeric expression. The result of the numeric-expression is                      LET                             0036                                moved into the numeric-variable (which is also referred to as the                  LET                             0037                                "receiving variable").                                                             LET                             0038                                                                                                                   LET                             0039                                The result of the numeric-expression is truncated or expanded (on                  LET                             0040                                the right or left) to match the length and precision of the                        LET                             0041                                receiving variable. However, if the receiving variable has been                    LET                             0042                                defined for rounding (see <ROUND,#HELPMT3>), the value of the                      LET                             0043                                numeric-argument will be rounded to the precision of the                           LET                             0044                                receiving variable.                                                                LET                             0045                                                                                                                   LET                             0046                              Example 1:                                                                           LET                             0047                                                                                                                   LET                             0048                                LENGTH 40 & LOCAL NAME$                                                            LET                             0049                                LENGTH 25 & LOCAL FIRST$, LAST$                                                    LET                             0050                                .                                                                                  LET                             0051                                .                                                                                  LET                             0052                                .                                                                                  LET                             0053                                LET NAME$ = FIRST$ + LAST$                                                         LET                             0054                                                                                                                   LET                             0055                                In the above example, the string variables named FIRST$ and LAST$                  LET                             0056                                are concatenated (combined) and the resulting string is stored in                  LET                             0057                                the string variable named NAME$. Notice that NAME$ is defined                      LET                             0058                                with a length of 40 while FIRST$ and LAST$ are each defined with                   LET                             0059                                a length of 25 characters. This means that truncation could                        LET                             0060                                result if the combined total number of characters of FIRST$ and                    LET                             0061                                LAST$ is greater than 50.                                                          LET                             0062                                                                                                                   LET                             0063                                Note: The assignment statement could also have been written                        LET                             0064                                without the word "LET". In this case it would appear as:                           LET                             0065                                                                                                                   LET                             0066                                   NAME$ = FIRST$ + LAST$                                                          LET                             0067                                                                                                                   LET                             0068                              Example 2:                                                                           LET                             0069                                                                                                                   LET                             0070                                LENGTH 8.2 & LOCAL CRLIMIT, ARTOTAL, CREDIT                                        LET                             0071                                .                                                                                  LET                             0072                                .                                                                                  LET                             0073                                .                                                                                  LET                             0074                                LET CREDIT = CRLIMIT - ARTOTAL                                                     LET                             0075                                                                                                                   LET                             0076                                In this example, a new value is assigned to the numeric variable                   LET                             0077                                named CREDIT. The value will equal the difference between the                      LET                             0078                                values in CRLIMIT and ARTOTAL. Since all of these variables are                    LET                             0079                                defined with a length and precision of 8.2, and the numeric                        LET                             0080                                expression is a subtraction operation, there is no concern about                   LET                             0081                                truncation of the result. However, see the next example for a                      LET                             0082                                possible truncation situation.                                                     LET                             0083                                                                                                                   LET                             0084                                Note: The assignment statement could also have been written                        LET                             0085                                without the word "LET". In this case it would appear as:                           LET                             0086                                                                                                                   LET                             0087                                   CREDIT = CRLIMIT - ARTOTAL                                                      LET                             0088                                                                                                                   LET                             0089                              Example 3:                                                                           LET                             0090                                                                                                                   LET                             0091                                LENGTH 8.2 & LOCAL TOTAL, CURRENT, AR30, AR60, AR90, AR120                         LET                             0092                                .                                                                                  LET                             0093                                .                                                                                  LET                             0094                                .                                                                                  LET                             0095                                TOTAL = CURRENT + AR30 + AR60 + AR90 + AR120                                       LET                             0096                                                                                                                   LET                             0097                                In this example, the values contained in five numeric variables                    LET                             0098                                are added together and the result is stored in the variable named                  LET                             0099                                TOTAL. Since all of the variables in this example are defined                      LET                             0100                                with a length and precision of 8.2 -- including the receiving                      LET                             0101                                variable TOTAL -- there could be possible truncation of the                        LET                             0102                                result. For example, if the sum of the five values exceeded                        LET                             0103                                999,999.99 (the maximum value storable in an 8.2 field), the                       LET                             0104                                result would be truncated on the left-hand side without warning                    LET                             0105                                of any kind.                                                                       LET                             0106                                                                                                                   LET                             0107                              Example 4:                                                                           LET                             0108                                                                                                                   LET                             0109                                LENGTH 30 & LOCAL COMPANY$                                                         LET                             0110                                LENGTH 5 & LOCAL VALUE$                                                            LET                             0111                                .                                                                                  LET                             0112                                .                                                                                  LET                             0113                                .                                                                                  LET                             0114                                VALUE$ = SUB(COMPANY$,1,5)                                                         LET                             0115                                                                                                                   LET                             0116                                This example shows a string function used as the string-                           LET                             0117                                expression. The function in this case is the SUB function -- one                   LET                             0118                                that derives a substring from a string value. In this example,                     LET                             0119                                the SUB function returns the first five characters of the value                    LET                             0120                                stored in COMPANY$ and stores the result in the variable named                     LET                             0121                                VALUE$.                                                                            LOCK                            0001                              Syntax:                                                                              LOCK                            0002                                                                                                                   LOCK                            0003                                LOCK (lun) [,EXCP=statement-label]                                                 LOCK                            0004                                                                                                                   LOCK                            0005                              Discussion:                                                                          LOCK                            0006                                                                                                                   LOCK                            0007                                The LOCK statement locks a logical unit number. It is a way to                     LOCK                            0008                                prevent a specified file from being opened by another user.                        LOCK                            0009                                                                                                                   LOCK                            0010                                The lun parameter is a numeric or symbolic constant that is                        LOCK                            0011                                previously assigned to a file by an <OPEN> statement -- it                         LOCK                            0012                                represents the logical unit to be locked.                                          LOCK                            0013                                                                                                                   LOCK                            0014                                If the LOCK statement is attempted while another user has the                      LOCK                            0015                                particular file open, an exception 7 (FILE UNAVAILABLE --                          LOCK                            0016                                LOCK/UNLOCK ERROR) will be encountered.                                            LOCK                            0017                                                                                                                   LOCK                            0018                              Example:                                                                             LOCK                            0019                                                                                                                   LOCK                            0020                                OPEN (1) "FILEB"                                                                   LOCK                            0021                                LOCK (1)                                                                           LOCK                            0022                                .                                                                                  LOCK                            0023                                .                                                                                  LOCK                            0024                                .                                                                                  LOCK                            0025                                UNLOCK (1)                                                                         LOCK                            0026                                CLOSE (1)                                                                          LOOP                            0001                              See the <DO> statement.                                                              MESSAGESUB                      0001                              Syntax:                                                                              MESSAGESUB                      0002                                                                                                                   MESSAGESUB                      0003                                MESSAGESUB statement-label                                                         MESSAGESUB                      0004                                                                                                                   MESSAGESUB                      0005                              Discussion:                                                                          MESSAGESUB                      0006                                                                                                                   MESSAGESUB                      0007                                The MESSAGESUB statement sets a branch-to address for the current                  MESSAGESUB                      0008                                program. If this program is interrupted while running (via an                      MESSAGESUB                      0009                                <INTERRUPT> statement from another program), program flow will be                  MESSAGESUB                      0010                                transferred to the statement-label specified in the MESSAGESUB                     MESSAGESUB                      0011                                statement.                                                                         MESSAGESUB                      0012                                                                                                                   MESSAGESUB                      0013                                When a <RETURN> statement is executed after the MESSAGESUB path                    MESSAGESUB                      0014                                has been taken, program flow continues at the statement                            MESSAGESUB                      0015                                immediately following the statement where the INTERRUPT occurred.                  MESSAGESUB                      0016                                                                                                                   MESSAGESUB                      0017                              Example:                                                                             MESSAGESUB                      0018                                                                                                                   MESSAGESUB                      0019                                MESSAGESUB 9999        ! Set MESSAGESUB label                                      MESSAGESUB                      0020                                .                                                                                  MESSAGESUB                      0021                                .                                                                                  MESSAGESUB                      0022                                .                                                                                  MESSAGESUB                      0023                                9999   MESSAGESUB 9999 ! Reset MESSAGESUB label                                    MESSAGESUB                      0024                                       RETURN                                                                      MID                             0001                              Syntax:                                                                              MID                             0002                                                                                                                   MID                             0003                                MID(string-argument)                                                               MID                             0004                                                                                                                   MID                             0005                              Discussion:                                                                          MID                             0006                                                                                                                   MID                             0007                                The MID statement returns a machine ID string and stores it in                     MID                             0008                                the string-argument. The eight-byte string is binary coded with a                  MID                             0009                                unique number based on the Comet serial number. Each byte of the                   MID                             0010                                machine ID string has a value in the range "00" to "FF" hex.                       MID                             0011                                                                                                                   MID                             0012                                Application note: Password validation routines can be developed                    MID                             0013                                for user applications using the MID statement.                                     MID                             0014                                                                                                                   MID                             0015                                The string-argument must be a string variable (single-element or                   MID                             0016                                an element of a string array).                                                     MID                             0017                                                                                                                   MID                             0018                              Example:                                                                             MID                             0019                                                                                                                   MID                             0020                                LENGTH 8 & LOCAL VALUE$                                                            MID                             0021                                .                                                                                  MID                             0022                                .                                                                                  MID                             0023                                .                                                                                  MID                             0024                                MID(VALUE$)                                                                        MID                             0025                                .                                                                                  MID                             0026                                .                                                                                  MID                             0027                                .                                                                                  MID                             0028                                                                                                                   MID                             0029                                This example shows how the MID statement is constructed. In the                    MID                             0030                                above example, an eight-byte string variable named VALUE$ is                       MID                             0031                                defined. In the Procedure Division of the program, the MID                         MID                             0032                                statement is used to return a unique machine ID. This value is                     MID                             0033                                placed in the variable VALUE$.                                                     MOVE                            0001                              Syntax:                                                                              MOVE                            0002                                                                                                                   MOVE                            0003                                MOVE (string-argument-1,string-argument-2,                                         MOVE                            0004                                     starting-position,length)                                                     MOVE                            0005                                                                                                                   MOVE                            0006                              Discussion:                                                                          MOVE                            0007                                                                                                                   MOVE                            0008                                The MOVE statement moves a specified number of characters from                     MOVE                            0009                                one string into another string, starting at a specified location                   MOVE                            0010                                in the second string.                                                              MOVE                            0011                                                                                                                   MOVE                            0012                                String-argument-1 may be a string constant, a single element                       MOVE                            0013                                string variable, a string array element, a string expression or a                  MOVE                            0014                                string function.                                                                   MOVE                            0015                                                                                                                   MOVE                            0016                                String-argument-2 must be a string variable.                                       MOVE                            0017                                                                                                                   MOVE                            0018                                The starting position and length are numeric values. They may be                   MOVE                            0019                                numeric constants, single element numeric variables, numeric                       MOVE                            0020                                array elements, numeric expressions, or numeric functions. The                     MOVE                            0021                                starting position is the position in the second string argument                    MOVE                            0022                                into which the characters from the first string argument are to                    MOVE                            0023                                be moved. The length is the number of characters to be moved.                      MOVE                            0024                                                                                                                   MOVE                            0025                              Example:                                                                             MOVE                            0026                                                                                                                   MOVE                            0027                                MOVE (A$,B$,2,3)                                                                   MOVE                            0028                                                                                                                   MOVE                            0029                                If A$ = "ABCDEFG" and B$ = "123456789", after the move operation,                  MOVE                            0030                                A$ will be "ABCDEFG" and B$ will be "1ABC56789".                                   NEXT                            0001                              Syntax:                                                                              NEXT                            0002                                                                                                                   NEXT                            0003                                NEXT control-variable                                                              NEXT                            0004                                                                                                                   NEXT                            0005                              Discussion:                                                                          NEXT                            0006                                                                                                                   NEXT                            0007                                The NEXT statement terminates a repetitive series of program                       NEXT                            0008                                statements (i.e., a loop). The statements between a <FOR>                          NEXT                            0009                                statement up to the associated NEXT statement form the loop.                       NEXT                            0010                                                                                                                   NEXT                            0011                                The control-variable parameter is a previously-defined numeric                     NEXT                            0012                                variable. Its start-count, stop-count, and increment values are                    NEXT                            0013                                established by the preceding FOR statement. The NEXT statement                     NEXT                            0014                                increments the control-variable and branches to the previous FOR                   NEXT                            0015                                statement.                                                                         NEXT                            0016                                                                                                                   NEXT                            0017                                FOR/NEXT loops may be nested to any level.                                         NEXT                            0018                                                                                                                   NEXT                            0019                              Example 1:                                                                           NEXT                            0020                                                                                                                   NEXT                            0021                                FOR VALUE = 1 TO 250        ! Start loop from 1 to 250                             NEXT                            0022                                SQUARE = VALUE * VALUE      ! Compute square                                       NEXT                            0023                                PRINT (0) VALUE;SQUARE      ! Print value and square                               NEXT                            0024                                NEXT VALUE                  ! Continue loop                                        NEXT                            0025                                                                                                                   NEXT                            0026                              Example 2:                                                                           NEXT                            0027                                                                                                                   NEXT                            0028                                FOR LINE = 1 TO 60          ! Loop from 1 to 60                                    NEXT                            0029                                READ (1,DATA) EXCP=9999     ! Read the next data record                            NEXT                            0030                                PRINT (2,INFO)              ! Print a line on the printer                          NEXT                            0031                                NEXT LINE                   ! Continue loop                                        NEXT                            0032                                                                                                                   NEXT                            0033                              Example 3:                                                                           NEXT                            0034                                                                                                                   NEXT                            0035                                FOR I = J TO K STEP M       ! Loop using variable values                           NEXT                            0036                                PRINT (0) "Value is: ";I    ! Print the value                                      NEXT                            0037                                NEXT I                      ! Continue loop                                        NEXT                            0038                                                                                                                   NEXT                            0039                              Example 4:                                                                           NEXT                            0040                                                                                                                   NEXT                            0041                                FOR ROW = 1 TO 50           ! Start outer loop (count 1 to 50)                     NEXT                            0042                                FOR COLUMN = 1 TO 200       ! Start inner loop (count 1 to 200)                    NEXT                            0043                                SUM=SUM+DATA(COLUMN,ROW)    ! Add up array elements                                NEXT                            0044                                NEXT COLUMN                 ! Continue inner loop                                  NEXT                            0045                                NEXT ROW                    ! Continue outer loop                                  NUM                             0001                              Syntax:                                                                              NUM                             0002                                                                                                                   NUM                             0003                                NUM(string-argument, numeric-error-argument)                                       NUM                             0004                                                                                                                   NUM                             0005                              Discussion:                                                                          NUM                             0006                                                                                                                   NUM                             0007                                The NUM function converts a string-argument into its equivalent                    NUM                             0008                                numeric value, only if the contents of the string-argument are                     NUM                             0009                                numeric characters.                                                                NUM                             0010                                                                                                                   NUM                             0011                                The string-argument may be a string constant, a single-element                     NUM                             0012                                string variable, a string array element, a string expression, or                   NUM                             0013                                a string function. The string-argument can contain only numeric                    NUM                             0014                                digits (0 through 9), a decimal point, a leading or trailing sign                  NUM                             0015                                (+ or -), and blank spaces.                                                        NUM                             0016                                                                                                                   NUM                             0017                                Notes:                                                                             NUM                             0018                                                                                                                   NUM                             0019                                1. If both leading a trailing signs are present in the string-                     NUM                             0020                                   argument, the trailing sign determines the sign of the result.                  NUM                             0021                                   The sign cannot be imbedded within the string-argument. If the                  NUM                             0022                                   sign is omitted, the value is considered to be positive.                        NUM                             0023                                                                                                                   NUM                             0024                                2. Only one decimal point is allowed in the string-argument. If                    NUM                             0025                                   no decimal point is present, it is assumed to follow the                        NUM                             0026                                   right-most digit.                                                               NUM                             0027                                                                                                                   NUM                             0028                                3. A blank space cannot appear within the string-argument value,                   NUM                             0029                                   but may separate the value from the sign(s).                                    NUM                             0030                                                                                                                   NUM                             0031                                4. Dollar signs ($) are not permitted in the string-argument.                      NUM                             0032                                                                                                                   NUM                             0033                                The numeric-error-argument is a numeric variable or numeric array                  NUM                             0034                                element with a length and precision of at least 1.0  If the NUM                    NUM                             0035                                function successfully converts the string-argument, the numeric-                   NUM                             0036                                error-argument is set to 0. If the conversion is unsuccessful, it                  NUM                             0037                                is set to 1.                                                                       NUM                             0038                                                                                                                   NUM                             0039                                Note: If the conversion is unsuccessful, the NUM function itself                   NUM                             0040                                will return a value of zero.                                                       NUM                             0041                                                                                                                   NUM                             0042                                The intermediate result of the NUM function is stored in an                        NUM                             0043                                accumulator with a fixed precision of 16.8. Digits that are more                   NUM                             0044                                than eight places on either side of the decimal point are                          NUM                             0045                                truncated. If the result is stored in a receiving numeric                          NUM                             0046                                variable, the precision is adjusted to the defined precision of                    NUM                             0047                                that variable.                                                                     NUM                             0048                                                                                                                   NUM                             0049                              Example:                                                                             NUM                             0050                                                                                                                   NUM                             0051                                VALUE = NUM(AMOUNT$,ERR)                                                           NUM                             0052                                                                                                                   NUM                             0053                                In the above example, the value contained in the string variable                   NUM                             0054                                AMOUNT$ is converted to numeric form. This result is then stored                   NUM                             0055                                in the numeric variable VALUE. The numeric-error-argument ERR                      NUM                             0056                                will be 0 if the conversion is successful or 1 if it is not                        NUM                             0057                                successful.                                                                        NUM                             0058                                                                                                                   NUM                             0059                                For example, if AMOUNT$ equals "5542.234-" (a string), then VALUE                  NUM                             0060                                will equal 5542.234- (a number), and ERR will equal 0 (indicating                  NUM                             0061                                a successful conversion).                                                          NUM                             0062                                                                                                                   NUM                             0063                                Or, if AMOUNT$ equals "555-1212" (a string), then VALUE will                       NUM                             0064                                equal 0 and ERR will equal 1 (indicating an unsuccessful                           NUM                             0065                                conversion due to the imbedded dash in the string-argument).                       NUMTODATE                       0001                              Syntax:                                                                              NUMTODATE                       0002                                                                                                                   NUMTODATE                       0003                                NUMTODATE(numeric-argument)                                                        NUMTODATE                       0004                                                                                                                   NUMTODATE                       0005                              Discussion:                                                                          NUMTODATE                       0006                                                                                                                   NUMTODATE                       0007                                The NUMTODATE function converts a "date serial number" to the                      NUMTODATE                       0008                                corresponding "date string."                                                       NUMTODATE                       0009                                                                                                                   NUMTODATE                       0010                                The numeric-argument is a 5-digit value (variable or constant)                     NUMTODATE                       0011                                that represents the number of days elapsed from a given "base                      NUMTODATE                       0012                                date."  The base date is January 1, 1800.                                          NUMTODATE                       0013                                                                                                                   NUMTODATE                       0014                                                                                                                   NUMTODATE                       0015                                Date serial number     Date string                                                 NUMTODATE                       0016                                ==================================                                                 NUMTODATE                       0017                                       0               "01011800"                                                  NUMTODATE                       0018                                   99999               "10152073"                                                  NUMTODATE                       0019                                                                                                                   NUMTODATE                       0020                                This function returns a date string in the following form:                         NUMTODATE                       0021                                "MMDDYYYY"                                                                         NUMTODATE                       0022                                                                                                                   NUMTODATE                       0023                                Note: This function respects the rules for leap years (i.e., the                   NUMTODATE                       0024                                years 1800 and 1900 were not leap years, but the year 2000 is a                    NUMTODATE                       0025                                leap year).                                                                        NUMTODATE                       0026                                                                                                                   NUMTODATE                       0027                                Also see <DATETONUM>.                                                              NUMTODATE                       0028                                                                                                                   NUMTODATE                       0029                              Example:                                                                             NUMTODATE                       0030                                                                                                                   NUMTODATE                       0031                                LENGTH   8 & LOCAL VALUE$                                                          NUMTODATE                       0032                                LENGTH 5.0 & LOCAL SERIAL                                                          NUMTODATE                       0033                                .                                                                                  NUMTODATE                       0034                                PRINT (0) "ENTER A DATE SERIAL NUMBER (#####):"                                    NUMTODATE                       0035                                INPUT (0) SERIAL                                                                   NUMTODATE                       0036                                IF SERIAL = 0 THEN RUN "QMONITOR"                                                  NUMTODATE                       0037                                VALUE$ = NUMTODATE(SERIAL)                                                         NUMTODATE                       0038                                PRINT (0) "THE DATE STRING IS:";VALUE$                                             ON/GOTO                         0001                              Syntax:                                                                              ON/GOTO                         0002                                                                                                                   ON/GOTO                         0003                                ON numeric-argument GOTO statement-list                                            ON/GOTO                         0004                                                                                                                   ON/GOTO                         0005                              Discussion:                                                                          ON/GOTO                         0006                                                                                                                   ON/GOTO                         0007                                The ON/GOTO statement transfers program control to a specific                      ON/GOTO                         0008                                statement-label based on the integer portion of the numeric-                       ON/GOTO                         0009                                argument.                                                                          ON/GOTO                         0010                                                                                                                   ON/GOTO                         0011                                The numeric-argument may be a single element numeric variable, a                   ON/GOTO                         0012                                numeric array element, a numeric expression, or a numeric                          ON/GOTO                         0013                                function.                                                                          ON/GOTO                         0014                                                                                                                   ON/GOTO                         0015                                The statement-list contains a minimum of three statement-labels,                   ON/GOTO                         0016                                separated by commas. The integer portion of the numeric-argument                   ON/GOTO                         0017                                determines which statement-label to use, based on a simple set of                  ON/GOTO                         0018                                rules.                                                                             ON/GOTO                         0019                                                                                                                   ON/GOTO                         0020                                If there are only three statement-labels, the rules are:                           ON/GOTO                         0021                                                                                                                   ON/GOTO                         0022                                Value of numeric-argument   Branch to statement-label                              ON/GOTO                         0023                                ===========================================================                        ON/GOTO                         0024                                negative                    first statement-label                                  ON/GOTO                         0025                                zero                        second statement-label                                 ON/GOTO                         0026                                positive                    third statement-label                                  ON/GOTO                         0027                                                                                                                   ON/GOTO                         0028                                If there are more than three labels, they represent positive                       ON/GOTO                         0029                                integer values of the numeric-argument, as follows:                                ON/GOTO                         0030                                                                                                                   ON/GOTO                         0031                                Value of numeric-argument   Branch to statement-label                              ON/GOTO                         0032                                ===========================================================                        ON/GOTO                         0033                                negative                    first statement-label                                  ON/GOTO                         0034                                zero                        second statement-label                                 ON/GOTO                         0035                                1                           third statement-label                                  ON/GOTO                         0036                                2                           fourth statement-label                                 ON/GOTO                         0037                                3                           fifth statement-label                                  ON/GOTO                         0038                                etc.                                                                               ON/GOTO                         0039                                                                                                                   ON/GOTO                         0040                                Note: If the value of the numeric-argument plus 2 is greater than                  ON/GOTO                         0041                                the number of branch labels in the statement-list, program                         ON/GOTO                         0042                                control is transferred to the last branch label in the list.                       ON/GOTO                         0043                                                                                                                   ON/GOTO                         0044                                For example, if the statement-list includes six statement-labels,                  ON/GOTO                         0045                                the sixth label represents the branch-to point for numeric-                        ON/GOTO                         0046                                argument values of 4 and greater.                                                  ON/GOTO                         0047                                                                                                                   ON/GOTO                         0048                                See <GOTO>.                                                                        ON/GOTO                         0049                                                                                                                   ON/GOTO                         0050                              Example 1:                                                                           ON/GOTO                         0051                                                                                                                   ON/GOTO                         0052                                ON X GOTO 100,200,300,400,500                                                      ON/GOTO                         0053                                                                                                                   ON/GOTO                         0054                                In the above example, the integer value of the numeric variable X                  ON/GOTO                         0055                                is used to determine where program control will be transferred.                    ON/GOTO                         0056                                                                                                                   ON/GOTO                         0057                                For example, if X is less than zero, program control will be                       ON/GOTO                         0058                                transferred to statement label 100. Likewise, if X equals 0,                       ON/GOTO                         0059                                control will be transferred to statement label 200.                                ON/GOTO                         0060                                                                                                                   ON/GOTO                         0061                                If X equals 1, control will be transferred to statement label                      ON/GOTO                         0062                                300, and if X equals 2, control will be transferred to statement                   ON/GOTO                         0063                                label 400.                                                                         ON/GOTO                         0064                                                                                                                   ON/GOTO                         0065                                If X is greater than or equal to 3, program control will be                        ON/GOTO                         0066                                transferred to the last statement-label on the list, in this case                  ON/GOTO                         0067                                statement 500.                                                                     ON/GOTO                         0068                                                                                                                   ON/GOTO                         0069                              Example 2:                                                                           ON/GOTO                         0070                                                                                                                   ON/GOTO                         0071                                ON CRLIMIT - ARTOTAL GOTO 100,100,200                                              ON/GOTO                         0072                                                                                                                   ON/GOTO                         0073                                In this example, the numeric-argument is the expression:                           ON/GOTO                         0074                                                                                                                   ON/GOTO                         0075                                        CRLIMIT - ARTOTAL                                                          ON/GOTO                         0076                                                                                                                   ON/GOTO                         0077                                The integer portion of this expression is used to determine where                  ON/GOTO                         0078                                program control will be transferred.                                               ON/GOTO                         0079                                                                                                                   ON/GOTO                         0080                                For example, if the expression yields a negative or zero value                     ON/GOTO                         0081                                (indicating that ARTOTAL is greater or equal to zero), control                     ON/GOTO                         0082                                will be transferred to statement-label 100.                                        ON/GOTO                         0083                                                                                                                   ON/GOTO                         0084                                If the expression yields a value of 1 or more, program control                     ON/GOTO                         0085                                will be transferred to statement-label 200.                                        OPEN                            0001                              Syntax:                                                                              OPEN                            0002                                                                                                                   OPEN                            0003                                OPEN (lun) filename|device-name [,DIR=directory]                                   OPEN                            0004                                    [,EXCP=statement-label]                                                        OPEN                            0005                                                                                                                   OPEN                            0006                              Discussion:                                                                          OPEN                            0007                                                                                                                   OPEN                            0008                                The OPEN statement opens a file or a peripheral device using a                     OPEN                            0009                                specified logical unit number.                                                     OPEN                            0010                                                                                                                   OPEN                            0011                                The <lun> parameter is the numeric or symbolic constant that is                    OPEN                            0012                                assigned to the specified file or device. Its value may be from 0                  OPEN                            0013                                thorough 49. The logical unit number assigned to a file or device                  OPEN                            0014                                remains in effect until the program is terminated, or until that                   OPEN                            0015                                logical unit number is closed. More than one logical unit number                   OPEN                            0016                                can be assigned to the same file or device.                                        OPEN                            0017                                                                                                                   OPEN                            0018                                The directory parameter is optional, and is the name of the Comet                  OPEN                            0019                                directory to be searched for the specified file. It can be a                       OPEN                            0020                                string constant or a string variable, with a maximum length of                     OPEN                            0021                                three characters. If a directory is specified, only that                           OPEN                            0022                                directory is searched for the file.                                                OPEN                            0023                                                                                                                   OPEN                            0024                                Also see <CLOSE>.                                                                  OPEN                            0025                                                                                                                   OPEN                            0026                              Example 1:                                                                           OPEN                            0027                                                                                                                   OPEN                            0028                                OPEN (1) "LP1",EXCP=9999    ! Open printer LP1                                     OPEN                            0029                                .                                                                                  OPEN                            0030                                .                                                                                  OPEN                            0031                                .                                                                                  OPEN                            0032                                CLOSE (1)                                                                          OPEN                            0033                                                                                                                   OPEN                            0034                              Example 2:                                                                           OPEN                            0035                                                                                                                   OPEN                            0036                                OPEN (2) "CUSTFILE",DIR="DSK",EXCP=5000    ! Open data file                        OPEN                            0037                                .                                                                                  OPEN                            0038                                .                                                                                  OPEN                            0039                                .                                                                                  OPEN                            0040                                CLOSE (2)                                                                          OPEN                            0041                                                                                                                   OPEN                            0042                              Example 3:                                                                           OPEN                            0043                                                                                                                   OPEN                            0044                                CLOSE (6) & OPEN (6) "WORKFILE"                                                    OPEN                            0045                                                                                                                   OPEN                            0046                                In this example, logical unit number 6 is first closed, then                       OPEN                            0047                                opened and assigned to a data file named "WORKFILE." This                          OPEN                            0048                                technique guarantees that the logical unit number is available                     OPEN                            0049                                before the OPEN statement is executed.                                             PASSWORD                        0001                              Syntax:                                                                              PASSWORD                        0002                                                                                                                   PASSWORD                        0003                                String-variable = PASSWORD                                                         PASSWORD                        0004                                                                                                                   PASSWORD                        0005                              Discussion:                                                                          PASSWORD                        0006                                                                                                                   PASSWORD                        0007                                The PASSWORD function returns the partition's password which has                   PASSWORD                        0008                                been previously defined by the <SECURE> statement.                                 PASSWORD                        0009                                                                                                                   PASSWORD                        0010                                The PASSWORD function requires a string variable with a length of                  PASSWORD                        0011                                up to 32 characters.                                                               PASSWORD                        0012                                                                                                                   PASSWORD                        0013                                The SECURE statement is used to store the partition's password.                    PASSWORD                        0014                                SECURE is a convenient way to store a unique value, such as the                    PASSWORD                        0015                                user's log-on password, in the partition's task header.                            PASSWORD                        0016                                                                                                                   PASSWORD                        0017                              Example:                                                                             PASSWORD                        0018                                                                                                                   PASSWORD                        0019                                PWORD$ = PASSWORD                                                                  PASSWORD                        0020                                                                                                                   PASSWORD                        0021                                The partition's password is returned in the string variable named                  PASSWORD                        0022                                PWORD$.                                                                            PAUSE                           0001                              Syntax:                                                                              PAUSE                           0002                                                                                                                   PAUSE                           0003                                PAUSE(numeric-argument)                                                            PAUSE                           0004                                                                                                                   PAUSE                           0005                              Discussion:                                                                          PAUSE                           0006                                                                                                                   PAUSE                           0007                                The PAUSE statement temporarily pauses processing of the current                   PAUSE                           0008                                program for a specified period of time.                                            PAUSE                           0009                                                                                                                   PAUSE                           0010                                The numeric-argument represents the specified period of time                       PAUSE                           0011                                expressed in 1/18ths of a second. The numeric-argument may be a                    PAUSE                           0012                                numeric constant, a numeric variable, a single element of a                        PAUSE                           0013                                numeric array, a numeric expression, or a numeric function.                        PAUSE                           0014                                                                                                                   PAUSE                           0015                              Example 1:                                                                           PAUSE                           0016                                                                                                                   PAUSE                           0017                                PAUSE(18)                                                                          PAUSE                           0018                                                                                                                   PAUSE                           0019                                This statement causes the current program to pause for one                         PAUSE                           0020                                second.                                                                            PAUSE                           0021                                                                                                                   PAUSE                           0022                              Example 2:                                                                           PAUSE                           0023                                                                                                                   PAUSE                           0024                                PRINT (0) "PLEASE ENTER THE PAUSE VALUE (IN SECONDS):"                             PAUSE                           0025                                INPUT (0) TIME                                                                     PAUSE                           0026                                HOLD = 18 * TIME                                                                   PAUSE                           0027                                PAUSE(HOLD)                                                                        PAUSE                           0028                                                                                                                   PAUSE                           0029                                In this example, the pause value is a variable. The program                        PAUSE                           0030                                prompts the user for a pause value, stores the value in the                        PAUSE                           0031                                numeric variable called TIME, multiplies that value by 18 (to                      PAUSE                           0032                                convert the time to the proper unit of measure), and pauses the                    PAUSE                           0033                                program for the specified length of time (in seconds).                             PCOMM                           0001                              Syntax:                                                                              PCOMM                           0002                                                                                                                   PCOMM                           0003                                PCOMM(partition [,EXCP=statement-label])                                           PCOMM                           0004                                                                                                                   PCOMM                           0005                              Discussion:                                                                          PCOMM                           0006                                                                                                                   PCOMM                           0007                                The PCOMM function returns the first 255 bytes (254 data bytes                     PCOMM                           0008                                plus 1 length byte) of <COMMON,#HELPMT3> data from a specified                     PCOMM                           0009                                partition.                                                                         PCOMM                           0010                                                                                                                   PCOMM                           0011                                The partition parameter may be a string constant, a single-                        PCOMM                           0012                                element string variable, a string array element, a string                          PCOMM                           0013                                expression, or a string function in the format "Pnn" (where "nn"                   PCOMM                           0014                                is a numeric value from "00" to "99").                                             PCOMM                           0015                                                                                                                   PCOMM                           0016                                Note: If the named partition has no COMMON, the PCOMM function                     PCOMM                           0017                                returns a null value.                                                              PCOMM                           0018                                                                                                                   PCOMM                           0019                                The <EXCP=> parameter is used to specify an exception path in                      PCOMM                           0020                                case an invalid partition name is specified.                                       PCOMM                           0021                                                                                                                   PCOMM                           0022                              Example:                                                                             PCOMM                           0023                                                                                                                   PCOMM                           0024                                LENGTH 254 & LOCAL DATA$                                                           PCOMM                           0025                                .                                                                                  PCOMM                           0026                                .                                                                                  PCOMM                           0027                                .                                                                                  PCOMM                           0028                                DATA$ = PCOMM("P05",EXCP=500)                                                      PCOMM                           0029                                                                                                                   PCOMM                           0030                                In the above example, the PCOMM function will return the first                     PCOMM                           0031                                255 bytes of COMMON data from partition "P05". This data will be                   PCOMM                           0032                                stored in the string variable named DATA$ (254 data bytes and one                  PCOMM                           0033                                length byte).                                                                      POP                             0001                              Syntax:                                                                              POP                             0002                                                                                                                   POP                             0003                                POP                                                                                POP                             0004                                                                                                                   POP                             0005                              Discussion:                                                                          POP                             0006                                                                                                                   POP                             0007                                The POP statement clears the most recent return address from the                   POP                             0008                                subroutine stack. It is used to exit from a subroutine with a                      POP                             0009                                control transfer statement other than <RETURN> (e.g., a <GOTO>                     POP                             0010                                statement), or perform a direct return to the main program from a                  POP                             0011                                nested subroutine.                                                                 POP                             0012                                                                                                                   POP                             0013                                Note: If the subroutine stack is empty, the POP statement has no                   POP                             0014                                effect (i.e, it does not result in an exception branch).                           POP                             0015                                                                                                                   POP                             0016                                Also see <POPALL>.                                                                 POP                             0017                                                                                                                   POP                             0018                              Example 1:                                                                           POP                             0019                                                                                                                   POP                             0020                                <GOSUB> 1000                                                                       POP                             0021                                .                                                                                  POP                             0022                                500     PRINT (0) "CUSTOMER OVER CREDIT LIMIT."                                    POP                             0023                                        .                                                                          POP                             0024                                1000    OPEN (1) "C1A", EXCP=9000                                                  POP                             0025                                        READ (1,1000) EXCP=8000                                                    POP                             0026                                        .                                                                          POP                             0027                                        IF ARTOTAL > CRLIMIT THEN POP & GOTO 500                                   POP                             0028                                        .                                                                          POP                             0029                                        <RETURN>                                                                   POP                             0030                                                                                                                   POP                             0031                                In the above example, the main section of the program directs                      POP                             0032                                control to subroutine label 1000. In that subroutine, if a                         POP                             0033                                certain condition is met (namely ARTOTAL greater than CREDIT                       POP                             0034                                limit), the most recent entry in the subroutine stack is popped                    POP                             0035                                and program control is transferred directly to statement 500 in                    POP                             0036                                the main section.                                                                  POP                             0037                                                                                                                   POP                             0038                              Example 2:                                                                           POP                             0039                                                                                                                   POP                             0040                                <GOSUB> 1000                                                                       POP                             0041                                .                                                                                  POP                             0042                                500     PRINT (0) "CUSTOMER OVER CREDIT LIMIT."                                    POP                             0043                                .                                                                                  POP                             0044                                1000    OPEN (1) "C1A",EXCP=9000                                                   POP                             0045                                        READ (1,1000) EXCP=8000                                                    POP                             0046                                        IF ARTOTAL > 0 THEN <GOSUB> 2000                                           POP                             0047                                1100    PRINT (0) "CUSTOMER INFORMATION:"                                          POP                             0048                                        .                                                                          POP                             0049                                        <RETURN>                                                                   POP                             0050                                                                                                                   POP                             0051                                2000    FLAG1$ = "Y"                                                               POP                             0052                                        IF ARTOTAL > CRLIMIT THEN POP & POP & GOTO 500                             POP                             0053                                        .                                                                          POP                             0054                                        <RETURN>                                                                   POP                             0055                                                                                                                   POP                             0056                                In this example, the main section of the program directs control                   POP                             0057                                to subroutine label 1000. Within that subroutine, if a certain                     POP                             0058                                condition is met (namely if ARTOTAL is greater than 0), program                    POP                             0059                                control is directed to a nested subroutine at label 2000.                          POP                             0060                                                                                                                   POP                             0061                                Within the nested subroutine, if a certain condition is met (in                    POP                             0062                                this case, ARTOTAL greater than CRLIMIT), the two most recent                      POP                             0063                                return addresses are popped from the subroutine stack, and                         POP                             0064                                program control is transferred directly to statement 500 in the                    POP                             0065                                main section.                                                                      POPALL                          0001                              Syntax:                                                                              POPALL                          0002                                                                                                                   POPALL                          0003                                POPALL                                                                             POPALL                          0004                                                                                                                   POPALL                          0005                              Discussion:                                                                          POPALL                          0006                                                                                                                   POPALL                          0007                                The POPALL statement clears all return addresses from the <GOSUB>                  POPALL                          0008                                stack. It is used to branch directly from a nested subroutine (at                  POPALL                          0009                                any level) to the main program.                                                    POPALL                          0010                                                                                                                   POPALL                          0011                                Note: If the subroutine stack is empty, the POPALL statement has                   POPALL                          0012                                no effect (i.e., it does not result in an exception branch).                       POPALL                          0013                                                                                                                   POPALL                          0014                                See <POP>.                                                                         POPALL                          0015                                                                                                                   POPALL                          0016                              Example:                                                                             POPALL                          0017                                                                                                                   POPALL                          0018                                <GOSUB> 1000                                                                       POPALL                          0019                                .                                                                                  POPALL                          0020                                500     PRINT (0) "CUSTOMER OVER CREDIT LIMIT."                                    POPALL                          0021                                .                                                                                  POPALL                          0022                                1000    OPEN (1) "C1A",EXCP=9000                                                   POPALL                          0023                                        READ (1,1000) EXCP=8000                                                    POPALL                          0024                                        IF ARTOTAL > 0 THEN <GOSUB> 2000                                           POPALL                          0025                                        .                                                                          POPALL                          0026                                        <RETURN>                                                                   POPALL                          0027                                                                                                                   POPALL                          0028                                2000    FLAG1$ = "Y"                                                               POPALL                          0029                                        IF ARTOTAL > CRLIMIT THEN POPALL AND GOTO 500                              POPALL                          0030                                        .                                                                          POPALL                          0031                                        <RETURN>                                                                   POPALL                          0032                                                                                                                   POPALL                          0033                                In this example, the main section of the program directs control                   POPALL                          0034                                to subroutine label 1000. Within that subroutine, if a certain                     POPALL                          0035                                condition is met (namely if ARTOTAL is greater than 0), program                    POPALL                          0036                                control is directed to a nested subroutine at label 2000.                          POPALL                          0037                                                                                                                   POPALL                          0038                                Within the nested subroutine, if a certain condition is met (in                    POPALL                          0039                                this case, ARTOTAL greater than CRLIMIT), all return addresses                     POPALL                          0040                                are popped from the subroutine stack and program control is                        POPALL                          0041                                transferred directly to statement 500 in the main section.                         POS                             0001                              Syntax:                                                                              POS                             0002                                                                                                                   POS                             0003                                POS(string-1, string-2)                                                            POS                             0004                                                                                                                   POS                             0005                              Discussion:                                                                          POS                             0006                                                                                                                   POS                             0007                                The POS function returns the position of one specified string                      POS                             0008                                argument within a second string argument.                                          POS                             0009                                                                                                                   POS                             0010                                The first string argument (string-1) is a string value whose                       POS                             0011                                position within the second string argument is to be determined.                    POS                             0012                                The second string argument (string-2) is the string value to be                    POS                             0013                                searched for the first string argument.                                            POS                             0014                                                                                                                   POS                             0015                                Both string arguments can be string constants, single-element                      POS                             0016                                string variables, or string array elements.                                        POS                             0017                                                                                                                   POS                             0018                                Either the first or the second string argument (but not both) can                  POS                             0019                                be a string expression or a string function.                                       POS                             0020                                                                                                                   POS                             0021                                The value returned by the POS function is the position within                      POS                             0022                                string-2 of the first character of the first occurrence (from                      POS                             0023                                left to right) of a substring equal to string-1. For internal                      POS                             0024                                string values, counting begins at character position 1.                            POS                             0025                                                                                                                   POS                             0026                                If string-1 does not equal a substring of string-2, the POS                        POS                             0027                                function returns a value of zero.                                                  POS                             0028                                                                                                                   POS                             0029                                The intermediate result of the POS function is stored in an                        POS                             0030                                accumulator with a precision of 16.8  If this result is then                       POS                             0031                                stored in a receiving numeric variable, its precision is adjusted                  POS                             0032                                to the defined precision of that variable.                                         POS                             0033                                                                                                                   POS                             0034                              Example 1:                                                                           POS                             0035                                                                                                                   POS                             0036                                X = POS(A$,B$)                                                                     POS                             0037                                                                                                                   POS                             0038                                In the above example, the value contained in the string variable                   POS                             0039                                A$ is compared to the value stored in B$. If a match is found,                     POS                             0040                                the POS function returns the matching position; this value is                      POS                             0041                                then stored in the numeric variable X.                                             POS                             0042                                                                                                                   POS                             0043                                For example, if A$ equals "AT" and B$ equals "SIGNATURE", then                     POS                             0044                                the POS function will return a value of 5 (the starting position                   POS                             0045                                of the string "AT" within the value "SIGNATURE".)                                  POS                             0046                                                                                                                   POS                             0047                              Example 2:                                                                           POS                             0048                                                                                                                   POS                             0049                                VALUE = POS(STR$,"ABCDEF")                                                         POS                             0050                                                                                                                   POS                             0051                                In this example, the value of string variable STR$ is compared to                  POS                             0052                                the string constant "ABCDEF". If the value of STR$ matches a                       POS                             0053                                portion of the constant, its position is returned and stored in                    POS                             0054                                the numeric variable VALUE.                                                        POS                             0055                                                                                                                   POS                             0056                                For example, if STR$ equals "B", the function will return a value                  POS                             0057                                of 2 (since "B" is in the second position of the string                            POS                             0058                                constant).                                                                         POS                             0059                                                                                                                   POS                             0060                                Or, if STR$ equals "Z", the function will return a value of zero,                  POS                             0061                                since "Z" is not contained in the constant.                                        POS                             0062                                                                                                                   POS                             0063                                Also, if STR$ equals "DE", the function will return a value of 4                   POS                             0064                                (the substring "DE" starts at the fourth position of the                           POS                             0065                                constant).                                                                         POS                             0066                                                                                                                   POS                             0067                              Example 3:                                                                           POS                             0068                                                                                                                   POS                             0069                                N = POS("SMITH",NAME$)                                                             POS                             0070                                                                                                                   POS                             0071                                In this example, the string constant "SMITH" is compared to the                    POS                             0072                                string variable NAME$. If "SMITH" is located anywhere within                       POS                             0073                                NAME$, its position will be returned and stored in the numeric                     POS                             0074                                variable N.                                                                        POS                             0075                                                                                                                   POS                             0076                                Note: If "SMITH" is not found in the variable NAME$, the POS                       POS                             0077                                function will return a value of zero. This programming technique                   POS                             0078                                can be useful for determining if a particular string value is                      POS                             0079                                contained within a specific data field.                                            POSITION                        0001                              Syntax:                                                                              POSITION                        0002                                                                                                                   POSITION                        0003                                POSITION (lun) KEY=argument [,EXCP=statement label]                                POSITION                        0004                                                                                                                   POSITION                        0005                              Discussion:                                                                          POSITION                        0006                                                                                                                   POSITION                        0007                                The POSITION statement moves the file pointer to a specified key.                  POSITION                        0008                                If the specified key is not found, the file pointer is moved to                    POSITION                        0009                                the next higher key in ascending <ASCII> order.                                    POSITION                        0010                                                                                                                   POSITION                        0011                                The <lun> must be opened to a keyed file. The KEY argument may be                  POSITION                        0012                                a string constant or string variable.                                              POSITION                        0013                                                                                                                   POSITION                        0014                                The file pointer will be positioned to the specified key or to                     POSITION                        0015                                the next higher record if the key is not found.                                    POSITION                        0016                                                                                                                   POSITION                        0017                                This statement does not result in runtime exceptions. For                          POSITION                        0018                                example, an exception 32 is not returned if the specified key is                   POSITION                        0019                                not found. Likewise, an exception 2 is not returned if the                         POSITION                        0020                                specified key is beyond the ASCII range of the keys in the file.                   POSITION                        0021                                                                                                                   POSITION                        0022                              Example:                                                                             POSITION                        0023                                                                                                                   POSITION                        0024                                POSITION (1) KEY=CUSTNO$, EXCP=9999                                                PREV                            0001                              Syntax:                                                                              PREV                            0002                                                                                                                   PREV                            0003                                PREV(lun [,EXCP=statement-label])                                                  PREV                            0004                                                                                                                   PREV                            0005                              Discussion:                                                                          PREV                            0006                                                                                                                   PREV                            0007                                The PREV function returns the value of the key immediately                         PREV                            0008                                previous to the current file pointer file attached to the                          PREV                            0009                                specified logical unit number. This feature provides a method for                  PREV                            0010                                a program to read backwards through a keyed file. (See the <FILE>                  PREV                            0011                                statement for another method to read backwards through a keyed                     PREV                            0012                                file.)                                                                             PREV                            0013                                                                                                                   PREV                            0014                                The PREV function does not move the record pointer in the file.                    PREV                            0015                                To move the record pointer, you must use input/output statements                   PREV                            0016                                such as <READ> and <WRITE>.                                                        PREV                            0017                                                                                                                   PREV                            0018                              Example:                                                                             PREV                            0019                                                                                                                   PREV                            0020                                VALUE$ = PREV(1)  ! Get previous key in logical unit number 1                      PRINT                           0001                              Syntax:                                                                              PRINT                           0002                                                                                                                   PRINT                           0003                                PRINT (lun) variable-list [,EXCP=statement-label]                                  PRINT                           0004                                                                                                                   PRINT                           0005                              Discussion:                                                                          PRINT                           0006                                                                                                                   PRINT                           0007                                The PRINT statement allows simple, unformatted output to a file                    PRINT                           0008                                or a device without referencing a FORMAT statement, as well as                     PRINT                           0009                                formatted output using a <FORMAT,#HELPMT3> statement.                              PRINT                           0010                                                                                                                   PRINT                           0011                                The variable-list is one or more variable names or constants,                      PRINT                           0012                                separated by semi-colons.                                                          PRINT                           0013                                                                                                                   PRINT                           0014                                The rightmost character of a printed numeric field is reserved                     PRINT                           0015                                for a trailing sign. A decimal point is automatically inserted in                  PRINT                           0016                                the correct location. In the special case where numerics are                       PRINT                           0017                                declared as integers, the decimal point is not printed, but it                     PRINT                           0018                                appears as a blank to the left of the number.                                      PRINT                           0019                                                                                                                   PRINT                           0020                                String variables are displayed at their current length, which may                  PRINT                           0021                                or may not be the declared length.                                                 PRINT                           0022                                                                                                                   PRINT                           0023                                The unformatted PRINT statement is primarily used for I/O device                   PRINT                           0024                                output, but it can be used for indexed sequential and keyed                        PRINT                           0025                                files.                                                                             PRINT                           0026                                                                                                                   PRINT                           0027                                Note: PRINT can also reference a FORMAT statement and function                     PRINT                           0028                                the same as an unindexed <WRITE> statement. In this case, the                      PRINT                           0029                                syntax is:                                                                         PRINT                           0030                                                                                                                   PRINT                           0031                                   PRINT (lun, format-statement-label) [,EXCP=statement number]                    PRINT                           0032                                                                                                                   PRINT                           0033                                For more information, see the <I/O Format Division,#HELPMT3>.                      PRINT                           0034                                                                                                                   PRINT                           0035                              Example:                                                                             PRINT                           0036                                                                                                                   PRINT                           0037                                1000 FORMAT (EN);(SB);"CUSTOMER FILE";etc.                                         PRINT                           0038                                .                                                                                  PRINT                           0039                                .                                                                                  PRINT                           0040                                .                                                                                  PRINT                           0041                                PRINT (0,1000)                                                                     PSTAT                           0001                              Syntax:                                                                              PSTAT                           0002                                                                                                                   PSTAT                           0003                                PSTAT(partition [,EXCP=statement-label])                                           PSTAT                           0004                                                                                                                   PSTAT                           0005                              Discussion:                                                                          PSTAT                           0006                                                                                                                   PSTAT                           0007                                The PSTAT function returns the current status of a specified                       PSTAT                           0008                                partition.                                                                         PSTAT                           0009                                                                                                                   PSTAT                           0010                                The partition parameter is the name of the partition to check. It                  PSTAT                           0011                                may be a string constant or a string variable.                                     PSTAT                           0012                                                                                                                   PSTAT                           0013                              Return values:                                                                       PSTAT                           0014                                                                                                                   PSTAT                           0015                                Position     Length    Description                                                 PSTAT                           0016                                ======================================================                             PSTAT                           0017                                1            8         Program name                                                PSTAT                           0018                                9            2         Logical unit number                                         PSTAT                           0019                                11           8         Current file name                                           PSTAT                           0020                                19           3         Current file name extension                                 PSTAT                           0021                                22           3         Directory                                                   PSTAT                           0022                                25           2         Last system function (See QERCOMET)                         PSTAT                           0023                                29           3         Controlling terminal (TERM$)                                PSTAT                           0024                                32           3         Initiating terminal (ITERM$)                                PSTAT                           0025                                35           2         RUNSTATE value                                              PSTAT                           0026                                37           4         Next user address                                           PSTAT                           0027                                41           5         (5 blanks)                                                  PSTAT                           0028                                46           5         "30000"                                                     PSTAT                           0029                                51           5         "30000"                                                     PSTAT                           0030                                56           5         (5 blanks)                                                  PSTAT                           0031                                61           1         (1 blank)                                                   PSTAT                           0032                                62           150       50 DABS                                                     PSTAT                           0033                                                                                                                   PSTAT                           0034                              Example:                                                                             PSTAT                           0035                                                                                                                   PSTAT                           0036                                LENGTH 211 & LOCAL VALUE$                                                          PSTAT                           0037                                .                                                                                  PSTAT                           0038                                .                                                                                  PSTAT                           0039                                .                                                                                  PSTAT                           0040                                VALUE$ = PSTAT("P00",EXCP=9999)                                                    PSTAT                           0041                                                                                                                   PSTAT                           0042                                This example shows how the PSTAT function can be used to obtain                    PSTAT                           0043                                partition status information for partition "P00".                                  Procedure Division              0001                              Procedure Division                                                                   Procedure Division              0002                              ==================                                                                   Procedure Division              0003                                                                                                                   Procedure Division              0004                                The Procedure Division of an MTB program is the place where the                    Procedure Division              0005                                executable logic steps are written. This program section includes                  Procedure Division              0006                                statements to input and output data, control data files and                        Procedure Division              0007                                devices such as printers and terminals, assign values to data                      Procedure Division              0008                                variables, establish program loops, test logical and relational                    Procedure Division              0009                                conditions, etc.                                                                   Procedure Division              0010                                                                                                                   Procedure Division              0011                                See <Statement Summary>.                                                           Procedure Division              0012                                                                                                                   Procedure Division              0013                                The general syntax of statements in the Procedure Division is:                     Procedure Division              0014                                                                                                                   Procedure Division              0015                                   statement-label KEYWORD parameters                                              Procedure Division              0016                                                                                                                   Procedure Division              0017                                The statement-label may be used to define statements in this part                  Procedure Division              0018                                of the program that are used as branch-to points, such as                          Procedure Division              0019                                subroutines, exception routines, beginning of program sections,                    Procedure Division              0020                                etc. Statement-labels are not required on every statement in this                  Procedure Division              0021                                section, just those that will be used as branch-to points.                         Procedure Division              0022                                                                                                                   Procedure Division              0023                                Statement-labels may be numeric or alphanumeric. Numeric labels                    Procedure Division              0024                                may be one to four digits long, while alphanumeric labels may be                   Procedure Division              0025                                up to eight characters long. Alphanumeric labels, when defined,                    Procedure Division              0026                                are followed by a colon (:), but the colon is not used when the                    Procedure Division              0027                                statement-label is referred to from another part of the program.                   Procedure Division              0028                                                                                                                   Procedure Division              0029                                The KEYWORD refers to the MTB statement being used (e.g., PRINT,                   Procedure Division              0030                                INPUT, IF, CLOSE, RUN, GOTO), and "parameters" refers to the                       Procedure Division              0031                                items that typically accompany and MTB keyword (e.g., data                         Procedure Division              0032                                values, statement labels, format labels, program names).                           Procedure Division              0033                                                                                                                   Procedure Division              0034                              Example:                                                                             Procedure Division              0035                                                                                                                   Procedure Division              0036                                1000    <PRINT> (0,100)                                                            Procedure Division              0037                                        <INPUT> (0) CUSTNUM$                                                       Procedure Division              0038                                        <IF> CUSTNUM$ = "" THEN <CLOSE> (1) & <RUN> "QMONITOR"                     Procedure Division              0039                                        .                                                                          Procedure Division              0040                                        .                                                                          Procedure Division              0041                                        .                                                                          Procedure Division              0042                                        <GOTO> 1000                                                                Procedure Division              0043                                                                                                                   Procedure Division              0044                                Here, the statement label 1000 is used to identify the beginning                   Procedure Division              0045                                of a loop section in the program.                                                  READ                            0001                              Syntax:                                                                              READ                            0002                                                                                                                   READ                            0003                                READ (lun, format-statement-label) [KEY=index]                                     READ                            0004                                     [,EXCP=statement-label]                                                       READ                            0005                                                                                                                   READ                            0006                              Discussion:                                                                          READ                            0007                                                                                                                   READ                            0008                                The READ statement inputs a physical record from a keyed or                        READ                            0009                                indexed sequential data file into variables within the user                        READ                            0010                                program.                                                                           READ                            0011                                                                                                                   READ                            0012                                The format-statement-label parameter refers to the                                 READ                            0013                                <FORMAT,#HELPMT3> statement that defines the fields in the data                    READ                            0014                                record. These fields are listed in record order in the FORMAT                      READ                            0015                                statement (see Example 1 below).                                                   READ                            0016                                                                                                                   READ                            0017                                Successful execution of a READ statement automatically advances                    READ                            0018                                the file pointer to the next available record in key-sequential                    READ                            0019                                order.                                                                             READ                            0020                                                                                                                   READ                            0021                                The READIMAGE statement inputs all data and unpacks numeric data                   READ                            0022                                that has been stored in an image record (in packed form, two                       READ                            0023                                digits per byte). No decimal point is stored with packed numeric                   READ                            0024                                data. READIMAGE must be used in conjunction with                                   READ                            0025                                <WRITEIMAGE|WRITE> to properly store and retrieve data.                            READ                            0026                                                                                                                   READ                            0027                                The syntax is:                                                                     READ                            0028                                                                                                                   READ                            0029                                   READIMAGE (lun, format-statement-label) [KEY=index]                             READ                            0030                                             [,EXCP=statement-label]                                               READ                            0031                                                                                                                   READ                            0032                                Reading a keyed file may be done with a string index, a numeric                    READ                            0033                                index, or no index. With a string index, Comet will read the data                  READ                            0034                                record associated with the supplied key (index) value. With a                      READ                            0035                                numeric index, Comet will read the records in record number order                  READ                            0036                                without regard for the key tree. With no index, Comet will read                    READ                            0037                                the file in key-sequential order.                                                  READ                            0038                                                                                                                   READ                            0039                                Reading an indexed sequential file may be done with a numeric                      READ                            0040                                index or no index. With a numeric index, Comet will read the                       READ                            0041                                record matching the record number position specified. With no                      READ                            0042                                index, Comet will read the records in sequential order.                            READ                            0043                                                                                                                   READ                            0044                              Example 1:                                                                           READ                            0045                                                                                                                   READ                            0046                                1000 FORMAT CUSTNUM$;NAME$;ADDRESS$;CITY$;STATE$;ZIP$                              READ                            0047                                .                                                                                  READ                            0048                                .                                                                                  READ                            0049                                OPEN (1) "CUSTFILE"                                                                READ                            0050                                .                                                                                  READ                            0051                                .                                                                                  READ                            0052                                INPUT (0) CUSTNUM$                                                                 READ                            0053                                IF CUSTNUM$ = "" THEN CLOSE (1) & RUN QMONITOR                                     READ                            0054                                READ (1,1000) KEY=CUSTNUM$, EXCP=9999                                              READ                            0055                                .                                                                                  READ                            0056                                .                                                                                  READ                            0057                                9999    IF EXCP=32 THEN PRINT (0) "KEY NOT FOUND" & GOTO 100                       READ                            0058                                        IF EXCP=33 THEN PRINT (0) "RECORD LOCKED" & GOTO 100                       READ                            0059                                        ERROR                                                                      READ                            0060                                                                                                                   READ                            0061                                In this example, a keyed file named CUSTFILE is opened. The user                   READ                            0062                                inputs a specific customer number into the variable named                          READ                            0063                                CUSTNUM$, and the program reads the data file using this value as                  READ                            0064                                an index. If an exception occurs, the program branches to                          READ                            0065                                statement label 9999, where the system variable named EXCP is                      READ                            0066                                checked for the most probable exceptions (32 is the Comet                          READ                            0067                                exception for "KEY NOT FOUND" and 33 is the Comet exception for                    READ                            0068                                "RECORD UNAVAILABLE -- EXTRACT ERROR"). If the exception is the                    READ                            0069                                result of something other than these two, the program comes to an                  READ                            0070                                abnormal end (ERROR).                                                              READ                            0071                                                                                                                   READ                            0072                              Example 2:                                                                           READ                            0073                                                                                                                   READ                            0074                                READIMAGE (1,1000) KEY=CUSTNUM$,EXCP=9999                                          READ                            0075                                                                                                                   READ                            0076                                This example shows an equivalent READ statement to Example 1; the                  READ                            0077                                difference in this case is that the data record is stored in                       READ                            0078                                image format, so the program must use a READIMAGE statement to                     READ                            0079                                retrieve the record.                                                               READ                            0080                                                                                                                   READ                            0081                              Example 3:                                                                           READ                            0082                                                                                                                   READ                            0083                                INPUT (0) VALUE                                                                    READ                            0084                                READ (1,1000) KEY=VALUE, EXCP=9999                                                 READ                            0085                                                                                                                   READ                            0086                                This example shows how to read a record using a numeric index.                     READ                            0087                                                                                                                   READ                            0088                              Example 4:                                                                           READ                            0089                                                                                                                   READ                            0090                                READ (1,1000) EXCP=9999                                                            READ                            0091                                                                                                                   READ                            0092                                This example shows how to read a record in sequential or key-                      READ                            0093                                sequential order.                                                                  RENAME                          0001                              Syntax:                                                                              RENAME                          0002                                                                                                                   RENAME                          0003                                RENAME filename-1 [,DIR=directory-1],filename-2                                    RENAME                          0004                                       [,DIR=directory-2] [,EXCP=statement-label]                                  RENAME                          0005                                                                                                                   RENAME                          0006                              Discussion:                                                                          RENAME                          0007                                                                                                                   RENAME                          0008                                The RENAME statement renames a Comet file.                                         RENAME                          0009                                                                                                                   RENAME                          0010                                Filename-1 and directory-1 are the name and Comet directory name                   RENAME                          0011                                respectively of the original file. Filename-2 and directory-2 are                  RENAME                          0012                                the name and Comet directory name respectively of the renamed                      RENAME                          0013                                file.                                                                              RENAME                          0014                                                                                                                   RENAME                          0015                                Filename-1, directory-1, filename-2, and directory-3 are string                    RENAME                          0016                                values. Each may be a string constant, string variable, string                     RENAME                          0017                                expression, or string function.                                                    RENAME                          0018                                                                                                                   RENAME                          0019                                Note: Directory-1 and directory-2 must be located on the same DOS                  RENAME                          0020                                disk, even though they may be on different DOS directories or                      RENAME                          0021                                subdirectories.                                                                    RENAME                          0022                                                                                                                   RENAME                          0023                              Example 1:                                                                           RENAME                          0024                                                                                                                   RENAME                          0025                                RENAME "TESTFILE",DIR="DSK","ARCHIVE",DIR="SSI",EXCP=9999                          RENAME                          0026                                                                                                                   RENAME                          0027                                The above example renames the file TESTFILE located on Comet                       RENAME                          0028                                directory DSK. Its new name will be ARCHIVE and it will be                         RENAME                          0029                                located on Comet directory SSI (assuming that Comet directories                    RENAME                          0030                                DSK and SSI are located on the same DOS disk). If an exception                     RENAME                          0031                                occurs, the program branches to statement label 9999.                              RENAME                          0032                                                                                                                   RENAME                          0033                              Example 2:                                                                           RENAME                          0034                                                                                                                   RENAME                          0035                                RENAME FILE1$,,FILE2$                                                              RENAME                          0036                                                                                                                   RENAME                          0037                                This example renames a file using string variables. The file name                  RENAME                          0038                                stored in the string variable FILE1$ is renamed to the value                       RENAME                          0039                                stored in string variable FILE2$. Since no directory names are                     RENAME                          0040                                specified, the directory associated with FILE1$ will be used for                   RENAME                          0041                                FILE2$.                                                                            RETURN                          0001                              Syntax:                                                                              RETURN                          0002                                                                                                                   RETURN                          0003                                RETURN                                                                             RETURN                          0004                                                                                                                   RETURN                          0005                              Discussion:                                                                          RETURN                          0006                                                                                                                   RETURN                          0007                                The RETURN statement transfers program control to the statement                    RETURN                          0008                                immediately following the most recently invoked subroutine call.                   RETURN                          0009                                                                                                                   RETURN                          0010                                Subroutines are most commonly called with the <GOSUB> statement,                   RETURN                          0011                                although they may also be invoked with the <ERRORSUB>,                             RETURN                          0012                                <ESCAPESUB>, and <MESSAGESUB> statements, as well as MTB's                         RETURN                          0013                                <EXCPSUB=> parameter.                                                              RETURN                          0014                                                                                                                   RETURN                          0015                                All subroutine calls in MTB place a "return address" in a                          RETURN                          0016                                subroutine stack. The RETURN statement simply transfers program                    RETURN                          0017                                control to the address on the top of this stack. It also removes                   RETURN                          0018                                or "pops" the address from the top of the stack so that a                          RETURN                          0019                                subsequent RETURN statement will use the next address it finds on                  RETURN                          0020                                the top of the stack.                                                              RETURN                          0021                                                                                                                   RETURN                          0022                                Executing a RETURN statement with no return address in the                         RETURN                          0023                                subroutines stack causes a "GOSUB STACK UNDERFLOW" exception                       RETURN                          0024                                condition.                                                                         RETURN                          0025                                                                                                                   RETURN                          0026                                Also see <POP> and <POPALL>.                                                       RETURN                          0027                                                                                                                   RETURN                          0028                              Example:                                                                             RETURN                          0029                                                                                                                   RETURN                          0030                                OPEN (1) "C1A" EXCP=9000                                                           RETURN                          0031                                READ (1,1000) EXCP=8000                                                            RETURN                          0032                                PRINT (0) "PROCESSING CUSTOMER:";CUSTNO$                                           RETURN                          0033                                <GOSUB> 1000                                                                       RETURN                          0034                                PRINT (0) "COMPLETED CUSTOMER:";CUSTNO$                                            RETURN                          0035                                .                                                                                  RETURN                          0036                                STOP                                                                               RETURN                          0037                                                                                                                   RETURN                          0038                                1000 CRAVAIL = CRLIMIT - ARTOTAL                                                   RETURN                          0039                                .                                                                                  RETURN                          0040                                RETURN                                                                             RETURN                          0041                                                                                                                   RETURN                          0042                                In this example, the main section of the program opens a data                      RETURN                          0043                                file called "C1A", then reads a record from the file in                            RETURN                          0044                                sequential order. Next, the program displays a message on the                      RETURN                          0045                                video terminal (logical unit 0) and branches to a subroutine at                    RETURN                          0046                                statement-label 1000.                                                              RETURN                          0047                                                                                                                   RETURN                          0048                                Processing continues in the subroutine until the program                           RETURN                          0049                                encounters the RETURN statement. At this point, control is                         RETURN                          0050                                transferred back to the main section of the program (to the                        RETURN                          0051                                statement immediately after the GOSUB 1000 statement).                             RETURN                          0052                                                                                                                   RETURN                          0053                                The <STOP> statement is included in the main section of the                        RETURN                          0054                                program to prevent program flow from entering the subroutine                       RETURN                          0055                                without using the GOSUB statement.                                                 REWRITE                         0001                              Syntax:                                                                              REWRITE                         0002                                                                                                                   REWRITE                         0003                                REWRITE (lun, format-statement-label) KEY=index                                    REWRITE                         0004                                        [,EXCP=statement-label]                                                    REWRITE                         0005                                                                                                                   REWRITE                         0006                              Discussion:                                                                          REWRITE                         0007                                                                                                                   REWRITE                         0008                                The REWRITE statement functions just like the <WRITE> statement,                   REWRITE                         0009                                except that an exception is reported if the record does not                        REWRITE                         0010                                already exist. REWRITE can be used only on keyed files.                            REWRITE                         0011                                                                                                                   REWRITE                         0012                                The REWRITE IMAGE statement functions just like the                                REWRITE                         0013                                <WRITEIMAGE|WRITE> statement, except that an exception is                          REWRITE                         0014                                reported if the key that is being rewritten does not exist.                        REWRITE                         0015                                REWRITE IMAGE packs data and outputs it to a file in image                         REWRITE                         0016                                format.                                                                            REWRITE                         0017                                                                                                                   REWRITE                         0018                                The syntax is:                                                                     REWRITE                         0019                                                                                                                   REWRITE                         0020                                   REWRITE IMAGE (lun, format-statement-label) KEY=index                           REWRITE                         0021                                               [,EXCP=statement-label]                                             REWRITE                         0022                                                                                                                   REWRITE                         0023                              Example:                                                                             REWRITE                         0024                                                                                                                   REWRITE                         0025                                REWRITE (1,400) KEY=KEYNO$,EXCP=1600                                               REWRITE                         0026                                                                                                                   REWRITE                         0027                                In this example, the REWRITE statement is used to rewrite the                      REWRITE                         0028                                data record defined in format-statement-label 400. If the record                   REWRITE                         0029                                does not already exist, the exception branch is taken.                             RSUB                            0001                              Syntax:                                                                              RSUB                            0002                                                                                                                   RSUB                            0003                                RSUB(string-argument, position, length)                                            RSUB                            0004                                                                                                                   RSUB                            0005                              Discussion:                                                                          RSUB                            0006                                                                                                                   RSUB                            0007                                The RSUB function returns a substring from the right-hand side of                  RSUB                            0008                                the specified string argument.                                                     RSUB                            0009                                                                                                                   RSUB                            0010                                This function operates on the current length of the string-                        RSUB                            0011                                argument, rather than the defined length.                                          RSUB                            0012                                                                                                                   RSUB                            0013                                The string-argument may be a string constant, a single-element                     RSUB                            0014                                string variable, a string array element, a string expression, or                   RSUB                            0015                                a string function.                                                                 RSUB                            0016                                                                                                                   RSUB                            0017                                The position may be a numeric constant, a single-element numeric                   RSUB                            0018                                variable, a numeric array element, a numeric expression, or a                      RSUB                            0019                                numeric function. This parameter represents the rightmost                          RSUB                            0020                                position of the string-argument.                                                   RSUB                            0021                                                                                                                   RSUB                            0022                                The length may be a numeric constant, a single-element numeric                     RSUB                            0023                                variable, a numeric array element, a numeric expression, or a                      RSUB                            0024                                numeric function. This parameter represents the number of                          RSUB                            0025                                characters to be returned by the RSUB function.                                    RSUB                            0026                                                                                                                   RSUB                            0027                                Also see <SUB>.                                                                    RSUB                            0028                                                                                                                   RSUB                            0029                              Example 1:                                                                           RSUB                            0030                                                                                                                   RSUB                            0031                                ZIP$ = RSUB(ADDRESS2$,1,5)                                                         RSUB                            0032                                                                                                                   RSUB                            0033                                This example uses the RSUB function to return the last five                        RSUB                            0034                                characters of data from the variable named ADDRESS2$. The                          RSUB                            0035                                position is set to 1, indicating the right side of the string-                     RSUB                            0036                                argument. The length is set to 5, indicating the number of                         RSUB                            0037                                characters to be returned by the RSUB function.                                    RSUB                            0038                                                                                                                   RSUB                            0039                                If the value of ADDRESS2$ equals "Sebastopol, CA 95472", then the                  RSUB                            0040                                value of ZIP$ will equal "95472" -- the righthand 5 bytes of the                   RSUB                            0041                                field.                                                                             RSUB                            0042                                                                                                                   RSUB                            0043                              Example 2:                                                                           RSUB                            0044                                                                                                                   RSUB                            0045                                IF RSUB$(ADDRESS2$,1,5) = "95472" THEN PRINT (0) "Sebastopol"                      RSUB                            0046                                                                                                                   RSUB                            0047                                This example shows how the RSUB function can be used in-line with                  RSUB                            0048                                an IF statement. In this case, the RSUB function returns the last                  RSUB                            0049                                five characters of the variable named ADDRESS2$ (see Example 1                     RSUB                            0050                                above).                                                                            RUN                             0001                              Syntax:                                                                              RUN                             0002                                                                                                                   RUN                             0003                                RUN program [,DIR=directory] [,EXCP=statement-label]                               RUN                             0004                                                                                                                   RUN                             0005                              Discussion:                                                                          RUN                             0006                                                                                                                   RUN                             0007                                The RUN statement terminates the current program and calls in                      RUN                             0008                                another program to be loaded and executed in the same partition.                   RUN                             0009                                Because it causes an exit from the current program and transfers                   RUN                             0010                                control to the called program, RUN is the last statement to be                     RUN                             0011                                executed.                                                                          RUN                             0012                                                                                                                   RUN                             0013                                You cannot return to the original program automatically. It must                   RUN                             0014                                be recalled by another RUN statement.                                              RUN                             0015                                                                                                                   RUN                             0016                                Also see <ACTIVATE> and <ENTER>.                                                   RUN                             0017                                                                                                                   RUN                             0018                              Example 1:                                                                           RUN                             0019                                                                                                                   RUN                             0020                                RUN "MAINMENU",DIR="DSK"                                                           RUN                             0021                                                                                                                   RUN                             0022                                In this example, the RUN statement runs a program called                           RUN                             0023                                MAINMENU, which is located on directory DSK.                                       RUN                             0024                                                                                                                   RUN                             0025                              Example 2:                                                                           RUN                             0026                                                                                                                   RUN                             0027                                IF OPTION$="QUIT" THEN RUN "QMONITOR"                                              RUN                             0028                                                                                                                   RUN                             0029                                In this example, the variable named OPTION$ is tested. If OPTION$                  RUN                             0030                                is equal to "QUIT," the QMONITOR program is executed.                              SECURE                          0001                              Syntax:                                                                              SECURE                          0002                                                                                                                   SECURE                          0003                                SECURE string-argument                                                             SECURE                          0004                                                                                                                   SECURE                          0005                              Discussion:                                                                          SECURE                          0006                                                                                                                   SECURE                          0007                                The SECURE statement transfers a user-defined string to the                        SECURE                          0008                                password field of the partition executing the SECURE instruction.                  SECURE                          0009                                                                                                                   SECURE                          0010                                The string-argument may be a string constant or string variable,                   SECURE                          0011                                of 32 characters or less.                                                          SECURE                          0012                                                                                                                   SECURE                          0013                                The SECURE function is a convenient way to store a unique value,                   SECURE                          0014                                such as the user's log-on password, in the partition's task                        SECURE                          0015                                header. The value is stored with the SECURE statement and remains                  SECURE                          0016                                available to any MTB program as long as Comet is running. Note                     SECURE                          0017                                that the partition value is not saved when Comet is unloaded or                    SECURE                          0018                                otherwise stopped.                                                                 SECURE                          0019                                                                                                                   SECURE                          0020                                The <PASSWORD> function is used to retrieve the partition's                        SECURE                          0021                                password value.                                                                    SECURE                          0022                                                                                                                   SECURE                          0023                              Example:                                                                             SECURE                          0024                                                                                                                   SECURE                          0025                                SECURE PWORD$                                                                      SECURE                          0026                                                                                                                   SECURE                          0027                                The value stored in the string variable named PWORD$ will be                       SECURE                          0028                                stored as the partition's password.                                                SELECT                          0001                              Syntax:                                                                              SELECT                          0002                                                                                                                   SELECT                          0003                                SELECT CASE test expression                                                        SELECT                          0004                                                                                                                   SELECT                          0005                                   CASE expression list 1                                                          SELECT                          0006                                        [statement block 1]                                                        SELECT                          0007                                                                                                                   SELECT                          0008                                   CASE expression list 2                                                          SELECT                          0009                                        [statement block 2]                                                        SELECT                          0010                                   .                                                                               SELECT                          0011                                   .                                                                               SELECT                          0012                                   .                                                                               SELECT                          0013                                   CASE expression list n                                                          SELECT                          0014                                        [statement block n]                                                        SELECT                          0015                                                                                                                   SELECT                          0016                                   [CASE ANY MATCH]                                                                SELECT                          0017                                        [statement block]                                                          SELECT                          0018                                                                                                                   SELECT                          0019                                   [CASE ELSE]                                                                     SELECT                          0020                                        [statement block]                                                          SELECT                          0021                                                                                                                   SELECT                          0022                                ENDSELECT                                                                          SELECT                          0023                                                                                                                   SELECT                          0024                              Discussion:                                                                          SELECT                          0025                                                                                                                   SELECT                          0026                                Executes none or one of the several statement blocks, depending                    SELECT                          0027                                on the value of the test expression.                                               SELECT                          0028                                                                                                                   SELECT                          0029                                The statement blocks do not need to be indented. They are shown                    SELECT                          0030                                that way for the sake of clarity and source code readability.                      SELECT                          0031                                                                                                                   SELECT                          0032                                The test expression may be any numeric or string expression.                       SELECT                          0033                                                                                                                   SELECT                          0034                                The expression list elements may have any of the following forms:                  SELECT                          0035                                                                                                                   SELECT                          0036                                1. expression or expression list (expression list elements are                     SELECT                          0037                                   separated with a semicolon)                                                     SELECT                          0038                                2. FROM expression TO expression                                                   SELECT                          0039                                3. FROM expression THRU expression                                                 SELECT                          0040                                4. IS relational-operator expression                                               SELECT                          0041                                                                                                                   SELECT                          0042                                The expressions and operators in the expression list must be                       SELECT                          0043                                compatible with the test expression. The word "IS" must precede                    SELECT                          0044                                any relational operators. The word "FROM" must precede any range                   SELECT                          0045                                specification. The word "TO" means up to but not including. The                    SELECT                          0046                                word "THRU" means up to and including.                                             SELECT                          0047                                                                                                                   SELECT                          0048                                The selected expression is tested in sequence for each of the                      SELECT                          0049                                CASE clauses. Upon reaching the first successful test, the                         SELECT                          0050                                statement block following the CASE is executed, and control is                     SELECT                          0051                                then passed to one of several places:                                              SELECT                          0052                                                                                                                   SELECT                          0053                                a. If the structure does not contain a CASE ANY MATCH clause or a                  SELECT                          0054                                   CASE ELSE clause (both clauses are optional), control is                        SELECT                          0055                                   passed to the statement following the ENDSELECT statement.                      SELECT                          0056                                                                                                                   SELECT                          0057                                b. If the structure contains a CASE ANY MATCH clause, control is                   SELECT                          0058                                   passed to it. Following the execution of the CASE ANY MATCH                     SELECT                          0059                                   statement block, control is passed to one of two places:                        SELECT                          0060                                                                                                                   SELECT                          0061                                   *    If the structure does not contain a CASE ELSE clause,                      SELECT                          0062                                        control is passed to the statement following the                           SELECT                          0063                                        ENDSELECT statement.                                                       SELECT                          0064                                                                                                                   SELECT                          0065                                   *    If the structure contains a CASE ELSE clause, control is                   SELECT                          0066                                        passed to it. The CASE ELSE statement block is executed                    SELECT                          0067                                        and control is passed to the statement following the                       SELECT                          0068                                        ENDSELECT statement.                                                       SELECT                          0069                                                                                                                   SELECT                          0070                                c. If the structure contains a CASE ELSE and does not contain a                    SELECT                          0071                                   CASE ANY MATCH clause, control is passed to the CASE ELSE                       SELECT                          0072                                   clause. The CASE ELSE statement block is executed and control                   SELECT                          0073                                   is passed to the statement following the ENDSELECT statement.                   SELECT                          0074                                                                                                                   SELECT                          0075                                A BREAK statement may be used in the CASE structure. If used, the                  SELECT                          0076                                BREAK statement must be imbedded within an IF/THEN or                              SELECT                          0077                                IF/THEN/ELSE structure. The BREAK statement transfers control to                   SELECT                          0078                                the statement following the ENDSELECT statement.                                   SELECT                          0079                                                                                                                   SELECT                          0080                              Example:                                                                             SELECT                          0081                                                                                                                   SELECT                          0082                                SELECT CASE TEMP                 ! use the TEMP variable                           SELECT                          0083                                                                                                                   SELECT                          0084                                CASE IS GT 102                   ! a relational operator clause                    SELECT                          0085                                PRINT (0) "It's over 102 degrees"     ! conditional PRINT                          SELECT                          0086                                                                                                                   SELECT                          0087                                CASE 100;101;102                 ! multiple expressions                            SELECT                          0088                                PRINT (0) "It's a bit above 100"      ! conditional PRINT                          SELECT                          0089                                                                                                                   SELECT                          0090                                IF TEMP LT 102 BREAK             ! if true, jump to end                            SELECT                          0091                                   PRINT (0) " and heading higher"    ! otherwise, PRINT                           SELECT                          0092                                ENDIF                            ! end of IF structure                             SELECT                          0093                                                                                                                   SELECT                          0094                                CASE FROM 80 THRU 99             ! range of values                                 SELECT                          0095                                PRINT (0) "It is mighty warm today"   ! conditional PRINT                          SELECT                          0096                                                                                                                   SELECT                          0097                                CASE ANY MATCH                   ! if any of above match                           SELECT                          0098                                PRINT (0) "Hope is it warm tomorrow"  ! conditional PRINT                          SELECT                          0099                                                                                                                   SELECT                          0100                                CASE ELSE                        ! if none of above match                          SELECT                          0101                                PRINT (0) "It is below 80 degrees"    ! conditional PRINT                          SELECT                          0102                                                                                                                   SELECT                          0103                                ENDSELECT                        ! end of CASE structure                           SELECT                          0104                                                                                                                   SELECT                          0105                                Additional discussion:                                                             SELECT                          0106                                                                                                                   SELECT                          0107                                The SELECT structure encompasses several MTB keywords, including                   SELECT                          0108                                SELECT, CASE, ENDSELECT, FROM, TO, THRU, IS, ANY, and MATCH. The                   SELECT                          0109                                basic outline of a CASE structure is:                                              SELECT                          0110                                                                                                                   SELECT                          0111                                SELECT CASE test expression ! identify the test expression                         SELECT                          0112                                                                                                                   SELECT                          0113                                CASE expression list 1      ! test the first case                                  SELECT                          0114                                   [statement block 1]      ! execute if first case is valid                       SELECT                          0115                                                                                                                   SELECT                          0116                                CASE expression list 2      ! test the second case                                 SELECT                          0117                                   [statement block 2]      ! execute if second case is valid                      SELECT                          0118                                .                                                                                  SELECT                          0119                                .                                                                                  SELECT                          0120                                .                                                                                  SELECT                          0121                                CASE expression list n      ! test the nth case                                    SELECT                          0122                                   [statement block n]      ! execute if nth case is valid                         SELECT                          0123                                                                                                                   SELECT                          0124                                CASE ANY MATCH              ! if any of the above cases are                        SELECT                          0125                                   [statement block]        ! matched, execute this block of code                  SELECT                          0126                                                            ! and jump to end of structure                         SELECT                          0127                                                            ! (this is an optional clause)                         SELECT                          0128                                                                                                                   SELECT                          0129                                CASE ELSE                   ! otherwise,                                           SELECT                          0130                                   [statement block]        ! execute this block of code                           SELECT                          0131                                                            ! (this is an optional clause)                         SELECT                          0132                                                                                                                   SELECT                          0133                                ENDSELECT                   ! end the structure                                    SELECT                          0134                                                                                                                   SELECT                          0135                                The test expression in the SELECT CASE statement may be any                        SELECT                          0136                                numeric or string expression.                                                      SELECT                          0137                                                                                                                   SELECT                          0138                                The expression list elements in the CASE statement may have any                    SELECT                          0139                                of several forms. The first form is simply an expression or                        SELECT                          0140                                constant value. For example:                                                       SELECT                          0141                                                                                                                   SELECT                          0142                                SELECT CASE VALUE           ! test the numeric variable VALUE                      SELECT                          0143                                CASE 50                     ! if VALUE = 50,                                       SELECT                          0144                                [statement block]           ! execute this code                                    SELECT                          0145                                CASE 75                     ! if VALUE = 75,                                       SELECT                          0146                                [statement block]           ! execute this code                                    SELECT                          0147                                ENDSELECT                   ! end the structure                                    SELECT                          0148                                                                                                                   SELECT                          0149                                Multiple expression list elements may be included in a single                      SELECT                          0150                                CASE statement. The elements are separated with a semicolon. For                   SELECT                          0151                                example:                                                                           SELECT                          0152                                                                                                                   SELECT                          0153                                SELECT CASE VALUE           ! test the numeric variable VALUE                      SELECT                          0154                                CASE 50;51;52;53            ! if VALUE is 50, 51, 52 or 53,                        SELECT                          0155                                [statement block]           ! execute this code                                    SELECT                          0156                                ENDSELECT                   ! end the structure                                    SELECT                          0157                                                                                                                   SELECT                          0158                                The CASE statement may also indicate a range of values, as                         SELECT                          0159                                follows:                                                                           SELECT                          0160                                                                                                                   SELECT                          0161                                CASE expression TO expression         ! up to but not including                    SELECT                          0162                                CASE FROM expression THRU expression  ! up to and including                        SELECT                          0163                                                                                                                   SELECT                          0164                                An example of this is:                                                             SELECT                          0165                                                                                                                   SELECT                          0166                                SELECT CASE VALUE           ! test the numeric variable VALUE                      SELECT                          0167                                CASE 50 TO 60               ! if VALUE is 50 to (but not                           SELECT                          0168                                                            ! including) 60,                                       SELECT                          0169                                [statement block]           ! then execute this code                               SELECT                          0170                                                            !                                                      SELECT                          0171                                CASE FROM 80 THRU 90        ! if VALUE is 80 to (and including)                    SELECT                          0172                                [statement block]           ! 90, then execute this code                           SELECT                          0173                                                            !                                                      SELECT                          0174                                ENDSELECT                   ! end the structure                                    SELECT                          0175                                                                                                                   SELECT                          0176                                The CASE statement may also include a relational-operator clause,                  SELECT                          0177                                as follows:                                                                        SELECT                          0178                                                                                                                   SELECT                          0179                                   CASE IS relational-operator expression                                          SELECT                          0180                                                                                                                   SELECT                          0181                                An example of this is:                                                             SELECT                          0182                                                                                                                   SELECT                          0183                                SELECT CASE VALUE           ! test the numeric variable VALUE                      SELECT                          0184                                CASE IS GT 102              ! if VALUE is greater than 102,                        SELECT                          0185                                [statement block]           ! then execute this code                               SELECT                          0186                                ENDSELECT                   ! end the structure                                    SELECT                          0187                                                                                                                   SELECT                          0188                                The CASE ANY MATCH clause is executed if one of the specific CASE                  SELECT                          0189                                values is matched. This statement is optional, but if included in                  SELECT                          0190                                the structure, must be written after the individual CASE clauses                   SELECT                          0191                                and before the CASE ELSE clause (if one is present). For example:                  SELECT                          0192                                                                                                                   SELECT                          0193                                SELECT CASE VALUE           ! test the numeric variable VALUE                      SELECT                          0194                                CASE 50                     ! if VALUE = 50,                                       SELECT                          0195                                [statement block]           !         execute this code                            SELECT                          0196                                CASE 75                     ! if VALUE = 75,                                       SELECT                          0197                                [statement block]           !         execute this code                            SELECT                          0198                                CASE ANY MATCH              ! if either of above cases is                          SELECT                          0199                                [statement block]           ! matched,execute this code, too                       SELECT                          0200                                ENDSELECT                   ! end the structure                                    SELECT                          0201                                                                                                                   SELECT                          0202                                The CASE ELSE clause may be included in the structure to handle                    SELECT                          0203                                cases that are not matched by any of the individual CASE clauses.                  SELECT                          0204                                This clause is optional, but if included in the structure, must                    SELECT                          0205                                be written as the final clause (just prior to the ENDSELECT                        SELECT                          0206                                statement). For example:                                                           SELECT                          0207                                                                                                                   SELECT                          0208                                SELECT CASE VALUE           ! test the numeric variable VALUE                      SELECT                          0209                                .                                                                                  SELECT                          0210                                .                                                                                  SELECT                          0211                                .                                                                                  SELECT                          0212                                CASE ELSE                   ! if none of the cases produce a                       SELECT                          0213                                [statement block]           ! match, execute this code                             SELECT                          0214                                ENDSELECT                                                                          SELECT                          0215                                                                                                                   SELECT                          0216                                The CASE structure may also include a BREAK statement. A BREAK                     SELECT                          0217                                statement, which must be imbedded within an IF/THEN or                             SELECT                          0218                                IF/THEN/ELSE structure, transfers control to the statement                         SELECT                          0219                                following the ENDSELECT statement. For example:                                    SELECT                          0220                                                                                                                   SELECT                          0221                                SELECT CASE VALUE           ! test the numeric variable VALUE                      SELECT                          0222                                .                                                                                  SELECT                          0223                                CASE ________               ! test one of the specific cases                       SELECT                          0224                                .                                                                                  SELECT                          0225                                   IF ________ THEN BREAK   ! if a condition is true, then break                   SELECT                          0226                                .                                                                                  SELECT                          0227                                ENDSELECT                                                                          SGN                             0001                              Syntax:                                                                              SGN                             0002                                                                                                                   SGN                             0003                                SGN(numeric-argument)                                                              SGN                             0004                                                                                                                   SGN                             0005                              Discussion:                                                                          SGN                             0006                                                                                                                   SGN                             0007                                The SGN function returns the sign (positive, negative or zero) of                  SGN                             0008                                a numeric value according to the following chart:                                  SGN                             0009                                                                                                                   SGN                             0010                                   Numeric-argument    Value returned                                              SGN                             0011                                   ======================================                                          SGN                             0012                                   positive                 1                                                      SGN                             0013                                   zero                     0                                                      SGN                             0014                                   negative                 1-                                                     SGN                             0015                                                                                                                   SGN                             0016                                The numeric-argument may be a numeric constant, a single-element                   SGN                             0017                                numeric variable, a numeric array element, a numeric expression,                   SGN                             0018                                or a numeric function.                                                             SGN                             0019                                                                                                                   SGN                             0020                                The intermediate result of the SGN function is stored in a                         SGN                             0021                                numeric accumulator with a length and precision of 16.0  If this                   SGN                             0022                                intermediate result is moved to a receiving numeric variable, its                  SGN                             0023                                precision is automatically adjusted to the defined precision of                    SGN                             0024                                that variable.                                                                     SGN                             0025                                                                                                                   SGN                             0026                              Example:                                                                             SGN                             0027                                                                                                                   SGN                             0028                                A = SGN(B)                                                                         SGN                             0029                                                                                                                   SGN                             0030                                In the above example, the sign of the value stored in the                          SGN                             0031                                variable B is moved to the variable A. For example, if B equals                    SGN                             0032                                25, A will equal 1. Likewise, if B equals -25, A will equal -1,                    SGN                             0033                                and if B equals 0, A will also equal 0.                                            SQRT                            0001                              Syntax:                                                                              SQRT                            0002                                                                                                                   SQRT                            0003                                SQRT(numeric-argument)                                                             SQRT                            0004                                                                                                                   SQRT                            0005                              Discussion:                                                                          SQRT                            0006                                                                                                                   SQRT                            0007                                The SQRT function returns the square root of a numeric-argument.                   SQRT                            0008                                                                                                                   SQRT                            0009                                This function is available in Comet 504 and greater, and is                        SQRT                            0010                                supported only on systems containing a math co-processor (i.e.,                    SQRT                            0011                                80287, 80387) or built-in math co-processor (i.e., 486, Pentium,                   SQRT                            0012                                Pentium Pro).                                                                      SQRT                            0013                                                                                                                   SQRT                            0014                              Example:                                                                             SQRT                            0015                                                                                                                   SQRT                            0016                                LENGTH 8.2 & LOCAL A, B                                                            SQRT                            0017                                .                                                                                  SQRT                            0018                                PRINT (0) "ENTER A NUMBER (######.##):"                                            SQRT                            0019                                INPUT (0)                                                                          SQRT                            0020                                B = SQRT(A)                                                                        SQRT                            0021                                PRINT (0) "THE SQUARE ROOT IS:";B                                                  STOP                            0001                              Syntax:                                                                              STOP                            0002                                                                                                                   STOP                            0003                                STOP                                                                               STOP                            0004                                                                                                                   STOP                            0005                              Discussion:                                                                          STOP                            0006                                                                                                                   STOP                            0007                                The STOP statement terminates a program at any point other than                    STOP                            0008                                its physical end. Execution of a STOP statement initiates a                        STOP                            0009                                termination procedure that closes all open logical unit numbers                    STOP                            0010                                and runs the QENDITOR utility program.                                             STOP                            0011                                                                                                                   STOP                            0012                                There can be more than one STOP statement in a program.                            STOP                            0013                                                                                                                   STOP                            0014                                Application note: The STOP statement is rarely used due to                         STOP                            0015                                numerous other ways to terminate program execution. The most                       STOP                            0016                                common program termination method is running another program via                   STOP                            0017                                the <RUN> statement. For unanticipated runtime exception                           STOP                            0018                                conditions, the <ERROR> statement is more commonly used.                           STOP                            0019                                                                                                                   STOP                            0020                                The STOP statement is a runtime statement, as opposed to the END                   STOP                            0021                                statement which is a compile-time statement indicating the                         STOP                            0022                                physical end of the source program.                                                STOP                            0023                                                                                                                   STOP                            0024                              Example:                                                                             STOP                            0025                                                                                                                   STOP                            0026                                READ (1,400) EXCP=1000                                                             STOP                            0027                                .                                                                                  STOP                            0028                                .                                                                                  STOP                            0029                                .                                                                                  STOP                            0030                                1000    IF EXCP NE 33 STOP                                                         STOP                            0031                                                                                                                   STOP                            0032                                In this example, the STOP statement is used in the exception                       STOP                            0033                                routine at statement-label 1000. In this case, if the system                       STOP                            0034                                variable <EXCP,#HELPMT3> does not equal 33 (which indicates that                   STOP                            0035                                a record is extracted by another user), the program will stop                      STOP                            0036                                executing.                                                                         STR                             0001                              Syntax:                                                                              STR                             0002                                                                                                                   STR                             0003                                STR(numeric-argument)                                                              STR                             0004                                                                                                                   STR                             0005                              Discussion:                                                                          STR                             0006                                                                                                                   STR                             0007                                The STR function converts a numeric value to a string value.                       STR                             0008                                                                                                                   STR                             0009                                The numeric-argument may be a numeric constant, a single-element                   STR                             0010                                numeric variable, a numeric array element, a numeric expression,                   STR                             0011                                or a numeric function.                                                             STR                             0012                                                                                                                   STR                             0013                                The length of the resultant value will equal the length of the                     STR                             0014                                numeric-argument (plus 1 character to account for the sign of an                   STR                             0015                                integer; plus 2 characters to account for the sign and decimal                     STR                             0016                                point of a real number) unless the numeric-argument is an                          STR                             0017                                expression.                                                                        STR                             0018                                                                                                                   STR                             0019                                Note: If the numeric-argument is an expression, the STR function                   STR                             0020                                returns 18 characters for a real number (16 digits plus a decimal                  STR                             0021                                point and sign) or 17 characters (16 digits plus a sign for an                     STR                             0022                                integer). The "precision" in the resulting string will be                          STR                             0023                                determined by the most precise element in the expression.                          STR                             0024                                                                                                                   STR                             0025                                The STR function provides a sign character at the right-hand side                  STR                             0026                                of the converted value. If the numeric-argument contains                           STR                             0027                                fractional digits, the STR function inserts a decimal point in                     STR                             0028                                the correct location.                                                              STR                             0029                                                                                                                   STR                             0030                                Note: If the result of the STR function is to be stored in a                       STR                             0031                                string field, the defined length of the receiving string field                     STR                             0032                                must include one byte for the decimal point (if applicable) and                    STR                             0033                                one byte for the sign character. If you do not want a sign                         STR                             0034                                character in the result, you can use <LET> statement to re-assign                  STR                             0035                                the result to a shorter string or use the SUB function to                          STR                             0036                                truncate the last character of the string.                                         STR                             0037                                                                                                                   STR                             0038                              Example 1:                                                                           STR                             0039                                                                                                                   STR                             0040                                LENGTH 6.2 & LOCAL NUMBER                                                          STR                             0041                                LENGTH   8 & LOCAL VALUE$                                                          STR                             0042                                .                                                                                  STR                             0043                                VALUE$ = STR(NUMBER)                                                               STR                             0044                                                                                                                   STR                             0045                                In the above example, the value contained in the numeric variable                  STR                             0046                                NUMBER is converted to a string and moved to the string variable                   STR                             0047                                VALUE$. Since NUMBER is defined with a length and precision of                     STR                             0048                                6.2, VALUE$ should be defined with a length of 8 (to account for                   STR                             0049                                the 6 digits, the decimal point, and the trailing sign).                           STR                             0050                                                                                                                   STR                             0051                                For example, if NUMBER equals 1234.56 (a numeric quantity), then                   STR                             0052                                VALUE$ will equal "1234.56 " (a string; note the trailing blank                    STR                             0053                                space indicating a positive number).                                               STR                             0054                                                                                                                   STR                             0055                              Example 2:                                                                           STR                             0056                                                                                                                   STR                             0057                                LENGTH 4.0 & LOCAL A                                                               STR                             0058                                LENGTH   5 & LOCAL Z$                                                              STR                             0059                                                                                                                   STR                             0060                                Z$ = STR(A)                                                                        STR                             0061                                                                                                                   STR                             0062                                In this example, A is defined with a length and precision of 4.0                   STR                             0063                                (an integer), so Z$ should be defined with a length of 5 (to                       STR                             0064                                account for the four digits and the sign; no space is required                     STR                             0065                                for a decimal point).                                                              STR                             0066                                                                                                                   STR                             0067                                For example, if A equals 5000-, then Z$ will equal "5000-" (note                   STR                             0068                                no decimal point and the trailing minus sign).                                     STRING                          0001                              Syntax:                                                                              STRING                          0002                                                                                                                   STRING                          0003                                STRING(string-argument, numeric-argument)                                          STRING                          0004                                                                                                                   STRING                          0005                              Discussion:                                                                          STRING                          0006                                                                                                                   STRING                          0007                                The STRING function assembles a string of identical characters of                  STRING                          0008                                specified length.                                                                  STRING                          0009                                                                                                                   STRING                          0010                                The character is determined by the string-argument, and the                        STRING                          0011                                number of characters assembled is determined by the numeric-                       STRING                          0012                                argument (or the defined length of the receiving string,                           STRING                          0013                                whichever is smaller).                                                             STRING                          0014                                                                                                                   STRING                          0015                                If the string-argument contains more than one character, only the                  STRING                          0016                                first character is used to build a repeating string.                               STRING                          0017                                                                                                                   STRING                          0018                                The string-argument may be a string constant, a single-element                     STRING                          0019                                string variable, a string array element, a string expression, or                   STRING                          0020                                a string function.                                                                 STRING                          0021                                                                                                                   STRING                          0022                                The numeric-argument may be a numeric constant, a single-element                   STRING                          0023                                numeric variable, a numeric array element, a numeric expression,                   STRING                          0024                                or a numeric function.                                                             STRING                          0025                                                                                                                   STRING                          0026                                Note: If the numeric-argument has a value less than 1, the                         STRING                          0027                                resulting string length will be zero. If the numeric-argument has                  STRING                          0028                                a value greater than 254, the resulting string length will be 254                  STRING                          0029                                (the maximum length of any string in MTB).                                         STRING                          0030                                                                                                                   STRING                          0031                                If the string-argument has a current length of zero, blanks (hex                   STRING                          0032                                "@20@") will be used as the repeat character.                                      STRING                          0033                                                                                                                   STRING                          0034                              Example:                                                                             STRING                          0035                                                                                                                   STRING                          0036                                STARS$ = STRING("*",80)                                                            STRING                          0037                                                                                                                   STRING                          0038                                In the above example, the string variable STARS$ is assigned a                     STRING                          0039                                value of 80 asterisks. It is assumed that STARS$ is defined with                   STRING                          0040                                a length of at least 80. If STARS$ is defined with a smaller                       STRING                          0041                                length -- 40 for example -- it will be filled completely with                      STRING                          0042                                asterisks.                                                                         STRIP                           0001                              Syntax:                                                                              STRIP                           0002                                                                                                                   STRIP                           0003                                STRIP(string-argument)                                                             STRIP                           0004                                                                                                                   STRIP                           0005                              Discussion:                                                                          STRIP                           0006                                                                                                                   STRIP                           0007                                The STRIP function strips leading and trailing blanks from a                       STRIP                           0008                                string expression. The resulting current length of the string is                   STRIP                           0009                                adjusted accordingly.                                                              STRIP                           0010                                                                                                                   STRIP                           0011                                The string-argument may be a string constant, a single-element                     STRIP                           0012                                string variable, a string array element, a string expression, or                   STRIP                           0013                                a string function.                                                                 STRIP                           0014                                                                                                                   STRIP                           0015                                See <STRIPL> and <STRIPR>.                                                         STRIP                           0016                                                                                                                   STRIP                           0017                              Example 1:                                                                           STRIP                           0018                                                                                                                   STRIP                           0019                                A$=STRIP(B$)                                                                       STRIP                           0020                                                                                                                   STRIP                           0021                                In the above example, the data contained in string variable B$ is                  STRIP                           0022                                stripped of leading and trailing blanks. The result is moved to                    STRIP                           0023                                the string variable A$.                                                            STRIP                           0024                                                                                                                   STRIP                           0025                                For example, if B$ equals "  Signature  " (note leading and                        STRIP                           0026                                trailing blanks), A$ will equal "Signature".                                       STRIP                           0027                                                                                                                   STRIP                           0028                              Example 2:                                                                           STRIP                           0029                                                                                                                   STRIP                           0030                                INPUT (0) OPTION$                                                                  STRIP                           0031                                IF STRIP(OPTION$) = "Y" THEN GOTO 9000                                             STRIP                           0032                                                                                                                   STRIP                           0033                                In this example, the variable OPTION$ is used to receive input                     STRIP                           0034                                from the video terminal (logical unit 0). Next, leading and                        STRIP                           0035                                trailing blanks are stripped from the variable and the result is                   STRIP                           0036                                compared to "Y". If the result equals "Y" the program branches to                  STRIP                           0037                                statement 9000.                                                                    STRIPL                          0001                              Syntax:                                                                              STRIPL                          0002                                                                                                                   STRIPL                          0003                                STRIPL(string-argument)                                                            STRIPL                          0004                                                                                                                   STRIPL                          0005                              Discussion:                                                                          STRIPL                          0006                                                                                                                   STRIPL                          0007                                The STRIPL function strips only leading blanks from a string-                      STRIPL                          0008                                argument.                                                                          STRIPL                          0009                                                                                                                   STRIPL                          0010                                The string-argument may be a string constant, a single-element                     STRIPL                          0011                                string variable, a string array element, a string expression, or                   STRIPL                          0012                                a string function.                                                                 STRIPL                          0013                                                                                                                   STRIPL                          0014                                See <STRIP> and <STRIPR>.                                                          STRIPL                          0015                                                                                                                   STRIPL                          0016                              Example:                                                                             STRIPL                          0017                                                                                                                   STRIPL                          0018                                A$=STRIPL(B$)                                                                      STRIPL                          0019                                                                                                                   STRIPL                          0020                                In the above example, the data contained in string variable B$ is                  STRIPL                          0021                                stripped of leading blanks; the result is moved to the string                      STRIPL                          0022                                variable A$.                                                                       STRIPL                          0023                                                                                                                   STRIPL                          0024                                For example, if B$ equals "  Signature  " (note leading and                        STRIPL                          0025                                trailing blanks), A$ will equal "Signature  " (note the remaining                  STRIPL                          0026                                trailing blanks).                                                                  STRIPR                          0001                              Syntax:                                                                              STRIPR                          0002                                                                                                                   STRIPR                          0003                                STRIPR(string-argument)                                                            STRIPR                          0004                                                                                                                   STRIPR                          0005                              Discussion:                                                                          STRIPR                          0006                                                                                                                   STRIPR                          0007                                The STRIPR function strips only trailing (right-hand side) blanks                  STRIPR                          0008                                from a string expression.                                                          STRIPR                          0009                                                                                                                   STRIPR                          0010                                The string-argument may be a string constant, a single-element                     STRIPR                          0011                                string variable, a string array element, a string expression, or                   STRIPR                          0012                                a string function.                                                                 STRIPR                          0013                                                                                                                   STRIPR                          0014                                See <STRIP> and <STRIPL>.                                                          STRIPR                          0015                                                                                                                   STRIPR                          0016                              Example:                                                                             STRIPR                          0017                                                                                                                   STRIPR                          0018                                A$=STRIPR(B$)                                                                      STRIPR                          0019                                                                                                                   STRIPR                          0020                                In the above example, the data contained in string variable B$ is                  STRIPR                          0021                                stripped of trailing blanks; the result is moved to the string                     STRIPR                          0022                                variable A$.                                                                       STRIPR                          0023                                                                                                                   STRIPR                          0024                                For example, if B$ equals "  Signature  " (note leading and                        STRIPR                          0025                                trailing blanks), A$ will equal "  Signature" (note the remaining                  STRIPR                          0026                                leading blanks).                                                                   STS                             0001                              Syntax:                                                                              STS                             0002                                                                                                                   STS                             0003                                STS(lun)                                                                           STS                             0004                                                                                                                   STS                             0005                              Discussion:                                                                          STS                             0006                                                                                                                   STS                             0007                                The STS returns the operating status of the specified logical                      STS                             0008                                unit number.                                                                       STS                             0009                                                                                                                   STS                             0010                                Executing the STS function results in up to seven bytes of string                  STS                             0011                                information describing the operating condition of a peripheral                     STS                             0012                                device (such as a terminal).                                                       STS                             0013                                                                                                                   STS                             0014                              Return values:                                                                       STS                             0015                                                                                                                   STS                             0016                                Byte    Description              Values                                            STS                             0017                                =================================================================                  STS                             0018                                1       Device type              0 = disk file                                     STS                             0019                                                                 2 = terminal                                      STS                             0020                                2       Terminal status          0 = inoperative                                   STS                             0021                                                                 1 = operative                                     STS                             0022                                3       Read request status      0 = not pending                                   STS                             0023                                                                 1 = pending                                       STS                             0024                                4       F2 status                0 = off                                           STS                             0025                                                                 1 = on                                            STS                             0026                                5       Slave printer status     0 = inoperative                                   STS                             0027                                                                 1 = operative                                     STS                             0028                                6       Terminal type            1 = VT3                                           STS                             0029                                                                 6 = VT6                                           STS                             0030                                7       Characters per line      0 = 64 characters per line                        STS                             0031                                                                 1 = 80 or 132 char. per line                      STS                             0032                                                                                                                   STS                             0033                              Example:                                                                             STS                             0034                                                                                                                   STS                             0035                                F2FLAG$ = SUB(STS(0),4,1)   ! Get F2 status byte                                   STS                             0036                                IF F2FLAG$ = "1" THEN GOTO 5000                                                    STS                             0037                                                                                                                   STS                             0038                                This example shows how to test for the F2 key. First, the STS                      STS                             0039                                function is executed for logical unit number 0, the controlling                    STS                             0040                                terminal. The fourth byte of the return value is the F2 status                     STS                             0041                                byte -- this is derived with the SUB function. If this byte                        STS                             0042                                equals "1" -- indicating that F2 is on -- the program branches to                  STS                             0043                                statement label 5000.                                                              SUB                             0001                              Syntax:                                                                              SUB                             0002                                                                                                                   SUB                             0003                                SUB(string-argument, starting-position, length)                                    SUB                             0004                                                                                                                   SUB                             0005                              Discussion:                                                                          SUB                             0006                                                                                                                   SUB                             0007                                The SUB function returns a substring of a specified string-                        SUB                             0008                                argument.                                                                          SUB                             0009                                                                                                                   SUB                             0010                                The string-argument is the string value from which the substring                   SUB                             0011                                is to be derived. It may be a string constant, a single-element                    SUB                             0012                                string variable, a string array element, a string expression, or                   SUB                             0013                                a string function.                                                                 SUB                             0014                                                                                                                   SUB                             0015                                The starting-position is a numeric value (constant, variable,                      SUB                             0016                                expression, or function) that indicates the starting character                     SUB                             0017                                position of the substring within the string argument. The                          SUB                             0018                                starting-position may be a numeric constant, a single-element                      SUB                             0019                                numeric variable, a numeric array element, a numeric expression,                   SUB                             0020                                or a numeric function.                                                             SUB                             0021                                                                                                                   SUB                             0022                                Length is a numeric value (constant, variable, expression, or                      SUB                             0023                                function) that indicates the length of the substring. The length                   SUB                             0024                                argument may be a numeric constant, a single-element numeric                       SUB                             0025                                variable, a numeric array element, a numeric expression, or a                      SUB                             0026                                numeric function. Note: If the length argument is zero or                          SUB                             0027                                negative, the SUB function will return a null value.                               SUB                             0028                                                                                                                   SUB                             0029                                See <RSUB>.                                                                        SUB                             0030                                                                                                                   SUB                             0031                              Example 1:                                                                           SUB                             0032                                                                                                                   SUB                             0033                                A$ = SUB(B$,5,2)                                                                   SUB                             0034                                                                                                                   SUB                             0035                                The above example returns a substring from the string variable                     SUB                             0036                                B$. The substring will contain two characters of data from B$                      SUB                             0037                                staring at character position 5. This value will be moved to the                   SUB                             0038                                string variable A$.                                                                SUB                             0039                                                                                                                   SUB                             0040                                For example, if B$ equals "SIGNATURE SYSTEMS" A$ will equal "AT".                  SUB                             0041                                                                                                                   SUB                             0042                              Example 2:                                                                           SUB                             0043                                                                                                                   SUB                             0044                                A$ = SUB("GoodBad Ugly",(4*X-3),4)                                                 SUB                             0045                                                                                                                   SUB                             0046                                This example shows how an expression can be used to determine the                  SUB                             0047                                starting-position in the string-argument. In this case, the                        SUB                             0048                                string-argument is a 12-character field equal to "GoodBad Ugly".                   SUB                             0049                                                                                                                   SUB                             0050                                The starting-position will be determined by the value of the                       SUB                             0051                                expression (4*X-3). For example, if the numeric variable X equals                  SUB                             0052                                1, the expression (and hence the starting-position) will equal 1.                  SUB                             0053                                                                                                                   SUB                             0054                                If X equals 2, the starting-position will equal 5 (the value of                    SUB                             0055                                the expression). And, if X equals 3, the starting-position will                    SUB                             0056                                equal 9.                                                                           SUB                             0057                                                                                                                   SUB                             0058                                So, depending on the value of X, different starting-positions may                  SUB                             0059                                be specified automatically. The length argument in the above                       SUB                             0060                                example is a constant 4 characters.                                                SUB                             0061                                                                                                                   SUB                             0062                                Thus, if X equals 1, the 4-character substring assigned to A$                      SUB                             0063                                will equal "Good" (because the starting-position will be 1 and                     SUB                             0064                                the length is 4).                                                                  SUB                             0065                                                                                                                   SUB                             0066                                If X equals 2, A$ will equal "Bad " (note the trailing blank),                     SUB                             0067                                and if X equals 3, A$ will equal "Ugly".                                           SUB                             0068                                                                                                                   SUB                             0069                                Application note: This programming technique may be a very useful                  SUB                             0070                                means to create conditional messages based on the value of a                       SUB                             0071                                numeric data variable.                                                             SWAP                            0001                              Syntax:                                                                              SWAP                            0002                                                                                                                   SWAP                            0003                                SWAP(string-variable-1,string-variable-2)                                          SWAP                            0004                                                                                                                   SWAP                            0005                              Discussion:                                                                          SWAP                            0006                                                                                                                   SWAP                            0007                                The SWAP function exchanges the contents of two string variables.                  SWAP                            0008                                                                                                                   SWAP                            0009                                The parentheses are optional.                                                      SWAP                            0010                                                                                                                   SWAP                            0011                              Example:                                                                             SWAP                            0012                                                                                                                   SWAP                            0013                                SWAP(A$,B$)                                                                        SWAP                            0014                                                                                                                   SWAP                            0015                                The contents of A$ and B$ are exchanged.                                           Statement Summary               0001                              Procedure Division Statements                                                        Statement Summary               0002                              =============================                                                        Statement Summary               0003                                                                                                                   Statement Summary               0004                                Also see <Common Parameters> and <Exception Handling>.                             Statement Summary               0005                                                                                                                   Statement Summary               0006                                Initialization statements                                                          Statement Summary               0007                                                                                                                   Statement Summary               0008                                <CLEAR>                                                                            Statement Summary               0009                                <CLEARLOCAL|CLEAR>                                                                 Statement Summary               0010                                <CLEARCOMMON|CLEAR>                                                                Statement Summary               0011                                                                                                                   Statement Summary               0012                                Assignment statements                                                              Statement Summary               0013                                                                                                                   Statement Summary               0014                                <LET>                                                                              Statement Summary               0015                                <SECURE>                                                                           Statement Summary               0016                                                                                                                   Statement Summary               0017                                                                                                                   Statement Summary               0018                                File and directory control statements                                              Statement Summary               0019                                                                                                                   Statement Summary               0020                                <FILE>                                                                             Statement Summary               0021                                <CREATE>                                                                           Statement Summary               0022                                <ERASE>                                                                            Statement Summary               0023                                <RENAME>                                                                           Statement Summary               0024                                <OPEN>                                                                             Statement Summary               0025                                <CLOSE>                                                                            Statement Summary               0026                                <LOCK>                                                                             Statement Summary               0027                                <UNLOCK>                                                                           Statement Summary               0028                                <ACCESS>                                                                           Statement Summary               0029                                                                                                                   Statement Summary               0030                                Input/output statements                                                            Statement Summary               0031                                                                                                                   Statement Summary               0032                                <INPUT>                                                                            Statement Summary               0033                                <PRINT>                                                                            Statement Summary               0034                                <READ>                                                                             Statement Summary               0035                                <INQUIRE>                                                                          Statement Summary               0036                                <EXTRACT>                                                                          Statement Summary               0037                                <WRITE>                                                                            Statement Summary               0038                                <INSERT>                                                                           Statement Summary               0039                                <POSITION>                                                                         Statement Summary               0040                                <REWRITE>                                                                          Statement Summary               0041                                <UPDATE>                                                                           Statement Summary               0042                                <DELETE>                                                                           Statement Summary               0043                                                                                                                   Statement Summary               0044                                General program control statements                                                 Statement Summary               0045                                                                                                                   Statement Summary               0046                                <GOTO>                                                                             Statement Summary               0047                                <ON/GOTO>                                                                          Statement Summary               0048                                <IF/THEN|IF>                                                                       Statement Summary               0049                                <IF/THEN/ELSE/ENDIF|IF>                                                            Statement Summary               0050                                <FOR/NEXT|FOR>                                                                     Statement Summary               0051                                <DO/LOOP|DO>                                                                       Statement Summary               0052                                <SELECT/CASE/ENDSELECT|SELECT>                                                     Statement Summary               0053                                <BREAK>                                                                            Statement Summary               0054                                <CONTINUE>                                                                         Statement Summary               0055                                <PAUSE>                                                                            Statement Summary               0056                                <WAKEUP>                                                                           Statement Summary               0057                                                                                                                   Statement Summary               0058                                Subroutine control statements                                                      Statement Summary               0059                                                                                                                   Statement Summary               0060                                <GOSUB>                                                                            Statement Summary               0061                                <RETURN>                                                                           Statement Summary               0062                                <POP>                                                                              Statement Summary               0063                                <POPALL>                                                                           Statement Summary               0064                                                                                                                   Statement Summary               0065                                Subprogram control statements                                                      Statement Summary               0066                                                                                                                   Statement Summary               0067                                <ENTER>                                                                            Statement Summary               0068                                <EXIT>                                                                             Statement Summary               0069                                <EXITALL>                                                                          Statement Summary               0070                                                                                                                   Statement Summary               0071                                Runtime exception control statements                                               Statement Summary               0072                                                                                                                   Statement Summary               0073                                <ERRORTO>                                                                          Statement Summary               0074                                <ERRORSUB>                                                                         Statement Summary               0075                                <ESCAPETO>                                                                         Statement Summary               0076                                <ESCAPESUB>                                                                        Statement Summary               0077                                <AGAIN>                                                                            Statement Summary               0078                                <EXCP=>                                                                            Statement Summary               0079                                <EXCPSUB=>                                                                         Statement Summary               0080                                                                                                                   Statement Summary               0081                                Program activation statements                                                      Statement Summary               0082                                                                                                                   Statement Summary               0083                                <RUN>                                                                              Statement Summary               0084                                <ACTIVATE>                                                                         Statement Summary               0085                                <INTERRUPT>                                                                        Statement Summary               0086                                <TERMINATE>                                                                        Statement Summary               0087                                <KILL>                                                                             Statement Summary               0088                                                                                                                   Statement Summary               0089                                Program termination statements                                                     Statement Summary               0090                                                                                                                   Statement Summary               0091                                <STOP>                                                                             Statement Summary               0092                                <END>                                                                              Statement Summary               0093                                <ERROR>                                                                            Statement Summary               0094                                                                                                                   Statement Summary               0095                                Numeric functions                                                                  Statement Summary               0096                                                                                                                   Statement Summary               0097                                <ABS>                                                                              Statement Summary               0098                                <ASC>                                                                              Statement Summary               0099                                <FPT>                                                                              Statement Summary               0100                                <INT>                                                                              Statement Summary               0101                                <LEN>                                                                              Statement Summary               0102                                <NUM>                                                                              Statement Summary               0103                                <NUMTODATE>                                                                        Statement Summary               0104                                <POS>                                                                              Statement Summary               0105                                <SGN>                                                                              Statement Summary               0106                                <SQRT>                                                                             Statement Summary               0107                                                                                                                   Statement Summary               0108                                String functions                                                                   Statement Summary               0109                                                                                                                   Statement Summary               0110                                <ADJUSTL/ADJUSTR>                                                                  Statement Summary               0111                                <ASCHEX>                                                                           Statement Summary               0112                                <CHKSUM>                                                                           Statement Summary               0113                                <CHR>                                                                              Statement Summary               0114                                <DATETONUM>                                                                        Statement Summary               0115                                <DECHEX>                                                                           Statement Summary               0116                                <FIRST>                                                                            Statement Summary               0117                                <HEXASC>                                                                           Statement Summary               0118                                <HEXDEC>                                                                           Statement Summary               0119                                <KEY>                                                                              Statement Summary               0120                                <LAST>                                                                             Statement Summary               0121                                <LCASE>                                                                            Statement Summary               0122                                <MID>                                                                              Statement Summary               0123                                <MOVE>                                                                             Statement Summary               0124                                <PASSWORD>                                                                         Statement Summary               0125                                <PCOMM>                                                                            Statement Summary               0126                                <PREV>                                                                             Statement Summary               0127                                <RSUB>                                                                             Statement Summary               0128                                <STR>                                                                              Statement Summary               0129                                <STRING>                                                                           Statement Summary               0130                                <STRIP>                                                                            Statement Summary               0131                                <STRIPL>                                                                           Statement Summary               0132                                <STRIPR>                                                                           Statement Summary               0133                                <SUB>                                                                              Statement Summary               0134                                <SWAP>                                                                             Statement Summary               0135                                <UCASE>                                                                            Statement Summary               0136                                                                                                                   Statement Summary               0137                                Status functions                                                                   Statement Summary               0138                                                                                                                   Statement Summary               0139                                <DSTAT>                                                                            Statement Summary               0140                                <FSTAT>                                                                            Statement Summary               0141                                <PSTAT>                                                                            Statement Summary               0142                                <STS>                                                                              Statement Summary               0143                                                                                                                   Statement Summary               0144                                DOS function calls                                                                 Statement Summary               0145                                                                                                                   Statement Summary               0146                                <DOSFC>                                                                            Statement Summary               0147                                <DOSMS>                                                                            Statement Summary               0148                                <DOSRW>                                                                            Statement Summary               0149                                                                                                                   Statement Summary               0150                                Compiler directives                                                                Statement Summary               0151                                                                                                                   Statement Summary               0152                                <USE>                                                                              Statement Summary               0153                                <ENDUSE>                                                                           Statement Summary               0154                                <SET>                                                                              Statement Summary               0155                                                                                                                   TERMINATE                       0001                              Syntax:                                                                              TERMINATE                       0002                                                                                                                   TERMINATE                       0003                                TERMINATE partition [,EXCP=statement-label]                                        TERMINATE                       0004                                                                                                                   TERMINATE                       0005                              Discussion:                                                                          TERMINATE                       0006                                                                                                                   TERMINATE                       0007                                The TERMINATE statement terminates a partition. The program                        TERMINATE                       0008                                running in the specified partition is stopped and the partition                    TERMINATE                       0009                                is forced to run the QMONITOR program.                                             TERMINATE                       0010                                                                                                                   TERMINATE                       0011                                The partition parameter is a string value (constant or variable)                   TERMINATE                       0012                                in the form "Pnn" (where "nn" is a value from 00 to 99).                           TERMINATE                       0013                                                                                                                   TERMINATE                       0014                                The TERMINATE statement is similar to the <KILL> statement, but                    TERMINATE                       0015                                does not override the exception handling routines for the                          TERMINATE                       0016                                partition (like KILL does). In this sense, KILL is more powerful                   TERMINATE                       0017                                than TERMINATE.                                                                    TERMINATE                       0018                                                                                                                   TERMINATE                       0019                                TERMINATE closes all files for the named partition.                                TERMINATE                       0020                                                                                                                   TERMINATE                       0021                                Note: Terminating an escape-protected partition (i.e., one where                   TERMINATE                       0022                                there is an <ESCAPETO> or <ESCAPESUB> instruction in force)                        TERMINATE                       0023                                causes the target partition to branch to the escape address.                       TERMINATE                       0024                                                                                                                   TERMINATE                       0025                              Example 1:                                                                           TERMINATE                       0026                                                                                                                   TERMINATE                       0027                                TERMINATE "P05",EXCP=9000                                                          TERMINATE                       0028                                                                                                                   TERMINATE                       0029                                In the above example, partition P05 is terminated. The program                     TERMINATE                       0030                                running in partition P05, if any, is terminated and the partition                  TERMINATE                       0031                                is forced to run the QMONITOR program.                                             TERMINATE                       0032                                                                                                                   TERMINATE                       0033                              Example 2:                                                                           TERMINATE                       0034                                                                                                                   TERMINATE                       0035                                PRINT (0) "ENTER PARTITION TO TERMINATE:"                                          TERMINATE                       0036                                INPUT (0) PART$                                                                    TERMINATE                       0037                                TERMINATE PART$,EXCP=9999                                                          TERMINATE                       0038                                                                                                                   TERMINATE                       0039                                In this example, a user-supplied partition name is terminated.                     TERMINATE                       0040                                This program displays a prompt, then accepts input into a                          TERMINATE                       0041                                variable named PART$. The value entered by the user will be                        TERMINATE                       0042                                substituted into the TERMINATE statement and the program running                   TERMINATE                       0043                                in that partition (if any) will be terminated.                                     UCASE                           0001                              Syntax:                                                                              UCASE                           0002                                                                                                                   UCASE                           0003                                UCASE(string-argument)                                                             UCASE                           0004                                                                                                                   UCASE                           0005                              Discussion:                                                                          UCASE                           0006                                                                                                                   UCASE                           0007                                The UCASE function converts lower case characters in a string-                     UCASE                           0008                                argument to upper case characters. Other characters in the                         UCASE                           0009                                string-argument (e.g., upper case characters, special characters)                  UCASE                           0010                                remain unchanged.                                                                  UCASE                           0011                                                                                                                   UCASE                           0012                                The string-argument may be a string constant, a single-element                     UCASE                           0013                                string variable, a string array element, a string expression, or                   UCASE                           0014                                a string function.                                                                 UCASE                           0015                                                                                                                   UCASE                           0016                                See <LCASE>.                                                                       UCASE                           0017                                                                                                                   UCASE                           0018                              Example 1:                                                                           UCASE                           0019                                                                                                                   UCASE                           0020                                Y$ = UCASE(X$)                                                                     UCASE                           0021                                                                                                                   UCASE                           0022                                In the above example, any lower case characters contained in X$                    UCASE                           0023                                are converted to upper case and the entire string is moved to Y$.                  UCASE                           0024                                For example, if X$ equals "Signature Systems" then Y$ will equal                   UCASE                           0025                                "SIGNATURE SYSTEMS".                                                               UCASE                           0026                                                                                                                   UCASE                           0027                              Example 2:                                                                           UCASE                           0028                                                                                                                   UCASE                           0029                                INPUT (0) ANSWER$                                                                  UCASE                           0030                                IF UCASE(ANSWER$) = "Y" THEN GOTO 9000                                             UCASE                           0031                                                                                                                   UCASE                           0032                                In this example, the variable ANSWER$ is used to receive input                     UCASE                           0033                                data from the terminal (logical unit 0). The data is then                          UCASE                           0034                                converted to upper case and compared to "Y". If it equals "Y" the                  UCASE                           0035                                program branches to statement 9000. Otherwise, program flow                        UCASE                           0036                                continues below the IF statement.                                                  UNLOCK                          0001                              Syntax:                                                                              UNLOCK                          0002                                                                                                                   UNLOCK                          0003                                UNLOCK (lun) [,EXCP=statement-label]                                               UNLOCK                          0004                                                                                                                   UNLOCK                          0005                              Discussion:                                                                          UNLOCK                          0006                                                                                                                   UNLOCK                          0007                                The UNLOCK statement removes the restriction of a previous <LOCK>                  UNLOCK                          0008                                on a file. It is issued on a <lun> which has been previously                       UNLOCK                          0009                                opened by the user. If a file is successfully locked, any other                    UNLOCK                          0010                                user will get an exception 7 on an attempted open, until the file                  UNLOCK                          0011                                is unlocked by the locking user.                                                   UNLOCK                          0012                                                                                                                   UNLOCK                          0013                              Example:                                                                             UNLOCK                          0014                                                                                                                   UNLOCK                          0015                                OPEN (1) "FILEB"                                                                   UNLOCK                          0016                                LOCK (1)                                                                           UNLOCK                          0017                                .                                                                                  UNLOCK                          0018                                .                                                                                  UNLOCK                          0019                                .                                                                                  UNLOCK                          0020                                UNLOCK (1)                                                                         UNLOCK                          0021                                CLOSE (1)                                                                          UNLOCK                          0022                                                                                                                   UNLOCK                          0023                                This example shows several related file statements. First, a data                  UNLOCK                          0024                                file is opened and locked. Later in the program, the file is                       UNLOCK                          0025                                unlocked and closed.                                                               UPDATE                          0001                              Syntax:                                                                              UPDATE                          0002                                                                                                                   UPDATE                          0003                                UPDATE (lun, format-statement-label) KEY=index                                     UPDATE                          0004                                       [,EXCP=statement-label]                                                     UPDATE                          0005                                                                                                                   UPDATE                          0006                              Discussion:                                                                          UPDATE                          0007                                                                                                                   UPDATE                          0008                                The UPDATE statement modifies only specified fields in a data                      UPDATE                          0009                                record of a file. The UPDATE statement extracts the specified                      UPDATE                          0010                                record (placing it in the user's buffer), moves the field(s)                       UPDATE                          0011                                being updated into the correct position(s) in the user's buffer                    UPDATE                          0012                                (as specified with a <FORMAT,#HELPMT3> statement), and rewrites                    UPDATE                          0013                                the data in the directory with an unindexed <WRITE> statement.                     UPDATE                          0014                                                                                                                   UPDATE                          0015                                Note: Because the record is temporarily extracted during an                        UPDATE                          0016                                UPDATE operation, other programs that access the same file must                    UPDATE                          0017                                be prepared for the possibility of encountering an extract                         UPDATE                          0018                                exception.                                                                         UPDATE                          0019                                                                                                                   UPDATE                          0020                                The UPDATEIMAGE statement modifies only specified fields in an                     UPDATE                          0021                                image data record. Numeric variables are output in a packed                        UPDATE                          0022                                format. The stored length of a string field is the declared                        UPDATE                          0023                                length plus one byte, used to store the current length of the                      UPDATE                          0024                                string.                                                                            UPDATE                          0025                                                                                                                   UPDATE                          0026                                The syntax is:                                                                     UPDATE                          0027                                                                                                                   UPDATE                          0028                                   UPDATEIMAGE (lun, format-statement-label) KEY=index                             UPDATE                          0029                                               [,EXCP=statement-label]                                             UPDATE                          0030                                                                                                                   UPDATE                          0031                              Example:                                                                             UPDATE                          0032                                                                                                                   UPDATE                          0033                                1000 FORMAT FLAG1$,@(50);FLAG2$,@(100)                                             UPDATE                          0034                                .                                                                                  UPDATE                          0035                                OPEN (1) "FILEB"                                                                   UPDATE                          0036                                .                                                                                  UPDATE                          0037                                FLAG1$ = "NEW"                                                                     UPDATE                          0038                                FLAG2$ = "TEST"                                                                    UPDATE                          0039                                UPDATE (1,1000) KEY=CUSTNUM$                                                       UPDATE                          0040                                                                                                                   UPDATE                          0041                                This example shows how to use the UPDATE statement to update                       UPDATE                          0042                                several fields in a data record. The FORMAT statement defines the                  UPDATE                          0043                                fields to be updated, and their positions in the data record. In                   UPDATE                          0044                                the Procedure Division of the program, the data variables are set                  UPDATE                          0045                                to their new values, and the UPDATE statement is executed.                         WAKEUP                          0001                              Syntax:                                                                              WAKEUP                          0002                                                                                                                   WAKEUP                          0003                                WAKEUP time-string                                                                 WAKEUP                          0004                                                                                                                   WAKEUP                          0005                              Discussion:                                                                          WAKEUP                          0006                                                                                                                   WAKEUP                          0007                                The WAKEUP statement suspends processing of the current program                    WAKEUP                          0008                                until a specified "wakeup time."                                                   WAKEUP                          0009                                                                                                                   WAKEUP                          0010                                The time-string parameter may be a string constant, a single-                      WAKEUP                          0011                                element string variable, a string array element, a string                          WAKEUP                          0012                                expression, or a string function in the format "HH:MM:SS" (where                   WAKEUP                          0013                                "HH" indicates the hour, "MM" indicates the minute, and "SS"                       WAKEUP                          0014                                indicates the second for the current program to resume                             WAKEUP                          0015                                processing).                                                                       WAKEUP                          0016                                                                                                                   WAKEUP                          0017                                The partition running a suspended program will show the program                    WAKEUP                          0018                                as active even though its processing has been suspended. No other                  WAKEUP                          0019                                jobs may be executed in this partition while the original program                  WAKEUP                          0020                                is suspended.                                                                      WAKEUP                          0021                                                                                                                   WAKEUP                          0022                                Application note: The WAKEUP statement does not require system                     WAKEUP                          0023                                resources and is preferred over other processing suspension                        WAKEUP                          0024                                methods, such as repetitive looping.                                               WAKEUP                          0025                                                                                                                   WAKEUP                          0026                              Example:                                                                             WAKEUP                          0027                                                                                                                   WAKEUP                          0028                                LENGTH 2 & LOCAL FLAG$                                                             WAKEUP                          0029                                .                                                                                  WAKEUP                          0030                                CLEAR                                                                              WAKEUP                          0031                                .                                                                                  WAKEUP                          0032                                WAKEUP "21:30:00"                                                                  WAKEUP                          0033                                .                                                                                  WAKEUP                          0034                                                                                                                   WAKEUP                          0035                                In the above example, the program will suspend processing as soon                  WAKEUP                          0036                                as it encounters the WAKEUP statement. The program will resume                     WAKEUP                          0037                                processing at 9:30 p.m.                                                            WAKEUP                          0038                                                                                                                   WRITE                           0001                              Syntax:                                                                              WRITE                           0002                                                                                                                   WRITE                           0003                                WRITE (lun, format-statement-label) [KEY=index]                                    WRITE                           0004                                      [,EXCP=statement-label]                                                      WRITE                           0005                                                                                                                   WRITE                           0006                              Discussion:                                                                          WRITE                           0007                                                                                                                   WRITE                           0008                                The WRITE statement outputs data records to a keyed, sequential,                   WRITE                           0009                                or contiguous data file.                                                           WRITE                           0010                                                                                                                   WRITE                           0011                                For keyed files, the key index can be any string expression. If                    WRITE                           0012                                the key index is shorter than the file key size, it is padded                      WRITE                           0013                                with trailing blanks. If it is longer than the key size, excess                    WRITE                           0014                                trailing characters are truncated before the WRITE statement is                    WRITE                           0015                                executed.                                                                          WRITE                           0016                                                                                                                   WRITE                           0017                                For sequential files, no key index is specified. In fact, doing                    WRITE                           0018                                so causes an exception branch.                                                     WRITE                           0019                                                                                                                   WRITE                           0020                                The WRITEIMAGE statement outputs a data record in image format                     WRITE                           0021                                (with packed numeric data). Data written in image format must be                   WRITE                           0022                                retrieved with a <READIMAGE|READ> statement.                                       WRITE                           0023                                                                                                                   WRITE                           0024                                The syntax is:                                                                     WRITE                           0025                                                                                                                   WRITE                           0026                                   WRITEIMAGE (lun, format-statement-label) [KEY=index]                            WRITE                           0027                                              [,EXCP=statement-label]                                              WRITE                           0028                                                                                                                   WRITE                           0029                              Example:                                                                             WRITE                           0030                                                                                                                   WRITE                           0031                                1000 FORMAT CUSTNUM$;NAME$;ADDRESS1$;ADDRESS2$                                     WRITE                           0032                                .                                                                                  WRITE                           0033                                OPEN (1) "CUSTFILE"                                                                WRITE                           0034                                .                                                                                  WRITE                           0035                                WRITE (1,1000) KEY=CUSTNUM$,EXCP=9999                                              WRITE                           0036                                                                                                                   WRITE                           0037                                In this example, the WRITE statement is used to write a data                       WRITE                           0038                                record to the CUSTFILE, a keyed file. The FORMAT statement                         WRITE                           0039                                determines the record layout of this data file and the KEY=                        WRITE                           0040                                parameter determines the key index being created.                                  lun                             0001  Logical Unit Number         Logical Unit Number                                                                  lun                             0002  Logical Unit Number         ===================                                                                  lun                             0003  Logical Unit Number                                                                                              lun                             0004  Logical Unit Number           The numeric or symbolic constant that is assigned to the file by                   lun                             0005  Logical Unit Number           an <OPEN> statement. Its value may be from 0 through 49. This                      lun                             0006  Logical Unit Number           parameter appears in all input/output statements.                                  lun                             0007  Logical Unit Number                                                                                              lun                             0008  Logical Unit Number           In a foreground partition, logical unit number 0 is assumed to be                  lun                             0009  Logical Unit Number           the terminal (screen). Thus logical units numbers 1 through 49                     lun                             0010  Logical Unit Number           are available for additional I/O devices such as data files,                       lun                             0011  Logical Unit Number           printers, communication devices, etc.                                              lun                             0012  Logical Unit Number                                                                                              lun                             0013  Logical Unit Number           In a background partition, logical unit number 0 is not assumed                    lun                             0014  Logical Unit Number           to be the terminal (as there is no terminal associated with a                      lun                             0015  Logical Unit Number           background partition).                                                             lun                             0016  Logical Unit Number                                                                                              lun                             0017  Logical Unit Number           Logical unit number assignments are concluded with the <CLOSE>                     lun                             0018  Logical Unit Number           statement and the <CLOSEALL> statement.                                            lun                             0019  Logical Unit Number                                                                                              lun                             0020  Logical Unit Number         Example 1:                                                                           lun                             0021  Logical Unit Number                                                                                              lun                             0022  Logical Unit Number           <PRINT> (0) "HELLO THERE."                                                         lun                             0023  Logical Unit Number                                                                                              lun                             0024  Logical Unit Number           This is example, the message "HELLO THERE" is printed (displayed)                  lun                             0025  Logical Unit Number           on logical unit number 0 (the video screen).                                       lun                             0026  Logical Unit Number                                                                                              lun                             0027  Logical Unit Number         Example 2:                                                                           lun                             0028  Logical Unit Number                                                                                              lun                             0029  Logical Unit Number           <OPEN> (1) "LP1"                                                                   lun                             0030  Logical Unit Number           .                                                                                  lun                             0031  Logical Unit Number           <PRINT> (1) "CUSTOMER MASTER LISTING"                                              lun                             0032  Logical Unit Number           .                                                                                  lun                             0033  Logical Unit Number           <CLOSE> (1)                                                                        lun                             0034  Logical Unit Number                                                                                              lun                             0035  Logical Unit Number           In this example, logical unit number 1 is associated with the                      lun                             0036  Logical Unit Number           printer named LP1. This association is established with the OPEN                   lun                             0037  Logical Unit Number           statement, then used via the PRINT statement, and finally                          lun                             0038  Logical Unit Number           concluded with the CLOSE statement.                                                lun                             0039  Logical Unit Number                                                                                              lun                             0040  Logical Unit Number         Example 3:                                                                           lun                             0041  Logical Unit Number                                                                                              lun                             0042  Logical Unit Number           1000 <FORMAT,#HELPMT3> CUSTNUM$;NAME$;ADDRESS$;CITY$;STATE$;ZIP$                   lun                             0043  Logical Unit Number                                                                                              lun                             0044  Logical Unit Number           <OPEN> (5) "CUSTFILE"                                                              lun                             0045  Logical Unit Number           .                                                                                  lun                             0046  Logical Unit Number           <READ> (5,1000) KEY=CUSTNUM$                                                       lun                             0047  Logical Unit Number           .                                                                                  lun                             0048  Logical Unit Number           <CLOSE> (5)                                                                        lun                             0049  Logical Unit Number                                                                                              lun                             0050  Logical Unit Number           In this example, logical unit number 5 is associated with the                      lun                             0051  Logical Unit Number           data file named "CUSTFILE." This association is established with                   lun                             0052  Logical Unit Number           the OPEN statement, then used via the READ statement, and finally                  lun                             0053  Logical Unit Number           concluded with the CLOSE statement.                                                ABS                                                                                                                                                    ACCESS                                                              300.                                                                               ACTIVATE                                                            program control will be transferred to statement 9000.                             ADJUSTL/ADJUSTR                                                     program then jumps to statement-label 9000.                                        AGAIN                                                               function yields A$ = "  ABC" (notice the leading blanks).                          ASC                                                                 the OPEN statement).                                                               ASCHEX                                                              namely 83. This value is stored in the variable VALUE.                             ASCII                                 The ASCII chart               parameter determines the key index being created.                                  BREAK                                                               and ERR will equal 0.                                                              CASE                                                                LOOP                   ! Loop back                                                 CHKSUM                                                            See the <SELECT> statement.                                                          CHR                                                                 variable VALUE$.                                                                   CLEAR                                                               is then stored in VALUE$.                                                          CLOSE                                                               statement.                                                                         CONTINUE                                                            before the OPEN statement is executed.                                             CREATE                                                              LOOP                   ! End the DO structure                                      Common Parameters                                                   of a loop section in the program.                                                  Copyright                                                                                                                                              DATETONUM                                                           label 8000.                                                                        DECHEX                                                              PRINT (0) "THE ERROR ARGUMENT IS:";ERRARG                                          DELETE                                                                                                                                                 DIR=                                  Directory name                Also see <EXCP=>.                                                                  DO                                                                                                                                                     DOSFC                                                               structure.                                                                         DOSMS                                                             statement.                                                                           DOSRW                                                             statement.                                                                           DSTAT                                                             statement.                                                                           DSTAT of a directory                                              5         1         Gateway subtype (hex)                                            DSTAT of a gateway                                                                    15H  = Terminal reset in progress                                DSTAT of a local printer                                          1         3         Clock name                                                       DSTAT of a remote printer                                         11        30        Path                                                             DSTAT of a spooler                                                11        1         ROM Version                                                      DSTAT of remote terminals                                         1         16        Network node name                                                DSTAT of the clock                                                4         27        DOS path name                                                    DSTAT of the console                                                <DSTAT of the clock>                                                               DSTAT of the system device (X00)                                  17        1         Current number of columns on screen                              ELSE                                                              1         27        DOS path name                                                    END                                                               See <IF/THEN/ELSE/ENDIF|IF>.                                                         ENDIF                                                               line in a source program.                                                          ENDSELECT                                                         See the <IF> statement.                                                              ENTER                                                             See the <SELECT> statement.                                                          ERASE                                                               statement immediately following the ENTER statement.                               ERROR                                                               be established before this statement is executed.                                  ERRORSUB                                                            of the program.                                                                    ERRORTO                                                             statement).                                                                        ESCAPESUB                                                           Otherwise it will initiate the ERROR termination procedure.                        ESCAPETO                                                            program).                                                                          EXCP=                                 Exception path                concluded with the CLOSE statement.                                                EXCPSUB=                              Exception subroutine          information.                                                                       EXIT                                                                will terminate and run "QMONITOR".                                                 EXITALL                                                             variable <EXCP,#HELPMT3> is interrogated.                                          EXTRACT                                                             to the top-level calling program.                                                  Exception Handling                                                          IF EXCP = 33 THEN ...         ! RECORD LOCKED EXCEPTION                    FILE                                                                program.                                                                           FILE BUF                                                            *  setting various <control functions|FILE CTL>                                    FILE CTL                                                               POS=EOF   moves the pointer to the end of the file                              FILE DLM                                                            integer in the range of 1 to 1,024.                                                FILE FORWARD                                                           crash, must always be restored from a backup.                                   FILE POS                                                            (i.e., a carriage return character).                                               FILE REVERSE                                                        example is redundant.                                                              FIRST                                                               descending ASCII order.                                                            FOR                                                                 exception-statement-label 9999.                                                    FPT                                                                 NEXT ROW                    ! Continue outer loop                                  FSTAT                                                               then A equals .43.                                                                 GOSUB                                                               file status information for a file named "C1A".                                    GOTO                                                                GOSUB call.                                                                        HEXASC                                                              IF/THEN statement).                                                                HEXDEC                                                              (the ASCII hex equivalents of the characters "1", "2", and "3").                   HOME                                                                First on-line edition September 1996.                                              IF                                                                     VALUE = ASC(STR$)                                                               INPUT                                                               INQUIRE (1,1000) KEY=CUSTNUM$, EXCP=9999                                           INQUIRE                                                             ENDIF                                                                              INSERT                                                              are stripped only from the final field (C$ in the above example).                  INT                                                                 INSERT (1,1000) KEY=CUSTNUM$,EXCP=9999                                             INTERRUPT                                                           then A equals 27.                                                                  KEY                                                                 interrupted.                                                                       KEY=                                  Key index                     record size of 1024 bytes and a key size of 64 bytes.                              KILL                                                                execution of the KEY function.                                                     LAST                                                                program running in that partition (if any) will be terminated.                     LCASE                                                               exception-statement-label 9999.                                                    LEN                                                                 continues below the IF statement.                                                  LET                                                                 "Signature" followed by 21 nulls. In this case N will equal 9.                     LOCK                                                                VALUE$.                                                                            LOOP                                                                CLOSE (1)                                                                          MESSAGESUB                                                        See the <DO> statement.                                                              MID                                                                        RETURN                                                                      MOVE                                                                placed in the variable VALUE$.                                                     NEXT                                                                A$ will be "ABCDEFG" and B$ will be "1ABC56789".                                   NUM                                                                 NEXT ROW                    ! Continue outer loop                                  NUMTODATE                                                           conversion due to the imbedded dash in the string-argument).                       ON/GOTO                                                             PRINT (0) "THE DATE STRING IS:";VALUE$                                             OPEN                                                                will be transferred to statement-label 200.                                        PASSWORD                                                            before the OPEN statement is executed.                                             PAUSE                                                               PWORD$.                                                                            PCOMM                                                               program for the specified length of time (in seconds).                             POP                                                                 length byte).                                                                      POPALL                                                              main section.                                                                      POS                                                                 transferred directly to statement 500 in the main section.                         POSITION                                                            contained within a specific data field.                                            PREV                                                                POSITION (1) KEY=CUSTNO$, EXCP=9999                                                PRINT                                                               VALUE$ = PREV(1)  ! Get previous key in logical unit number 1                      PSTAT                                                               PRINT (0,1000)                                                                     Procedure Division                                                  <Index|INDEX,#HELPMTB>                                                             READ                                                                partition status information for partition "P00".                                  RENAME                                                              sequential order.                                                                  RETURN                                                              FILE2$.                                                                            REWRITE                                                             without using the GOSUB statement.                                                 RSUB                                                                does not already exist, the exception branch is taken.                             RUN                                                                 above).                                                                            SECURE                                                              is equal to "QUIT," the QMONITOR program is executed.                              SELECT                                                              stored as the partition's password.                                                SGN                                                                 ENDSELECT                                                                          SQRT                                                                and if B equals 0, A will also equal 0.                                            STOP                                                                PRINT (0) "THE SQUARE ROOT IS:";B                                                  STR                                                                 executing.                                                                         STRING                                                              no decimal point and the trailing minus sign).                                     STRIP                                                               asterisks.                                                                         STRIPL                                                              statement 9000.                                                                    STRIPR                                                              trailing blanks).                                                                  STS                                                                 leading blanks).                                                                   SUB                                                                 statement label 5000.                                                              SWAP                                                                numeric data variable.                                                             Statement Summary                                                   <ERRRORSUB>, statements that set default exception paths.                          TERMINATE                                                           The contents of A$ and B$ are exchanged.                                           UCASE                                                               in that partition (if any) will be terminated.                                     UNLOCK                                                              continues below the IF statement.                                                  UPDATE                                                              unlocked and closed.                                                               WAKEUP                                                              to their new values, and the UPDATE statement is executed.                         WRITE                                                                                                                                                  lun                                   Logical Unit Number              <KEY=>key-index                                                                 